local DataStoreService = game:GetService("DataStoreService") local PlayerDataStore = DataStoreService:GetDataStore("PlayerDataStore") -- IDs de las texturas predeterminadas en el catálogo de Roblox local DefaultShirtTextureID = -- ID de la textura de la camiseta predeterminada local DefaultPantsTextureID = -- ID de la textura de los pantalones predeterminados game.Players.PlayerAdded:Connect(function(player) local userId = tostring(player.UserId) -- Intentar cargar las texturas guardadas del jugador local success, savedTextures = pcall(function() return PlayerDataStore:GetAsync(userId) end) local character = player.Character if character then character:ClearAllChildren() character.HumanoidRootPart.Anchored = true local humanoid = character:FindFirstChild("Humanoid") humanoid:RemoveAccessories() -- Quitar accesorios existentes local shirt = Instance.new("Shirt") local pants = Instance.new("Pants") if success and savedTextures then shirt.ShirtTemplate = savedTextures.ShirtTemplate or DefaultShirtTextureID pants.PantsTemplate = savedTextures.PantsTemplate or DefaultPantsTextureID else shirt.ShirtTemplate = DefaultShirtTextureID pants.PantsTemplate = DefaultPantsTextureID end shirt.Parent = character pants.Parent = character humanoid:BuildRigFromAttachments() -- Reconstruir el esqueleto character.HumanoidRootPart.Anchored = false end end) game.Players.PlayerRemoving:Connect(function(player) local userId = tostring(player.UserId) local character = player.Character if character then local shirtTemplate = character:FindFirstChild("Shirt"):GetAttribute("ShirtTemplate") local pantsTemplate = character:FindFirstChild("Pants"):GetAttribute("PantsTemplate") local texturesData = { ShirtTemplate = shirtTemplate, PantsTemplate = pantsTemplate } -- Guardar las texturas actuales del jugador en el DataStore pcall(function() PlayerDataStore:SetAsync(userId, texturesData) end) end end)