Players.PlayerAdded:Connect(function(player) -- Создаем таблицу для хранения информации об одежде player:SetAttribute("ShirtId", "") player:SetAttribute("PantsId", "")
-- Восстанавливаем одежду при входе player.CharacterAdded:Connect(function(character) local shirtId = player:GetAttribute("ShirtId") local pantsId = player:GetAttribute("PantsId")
if shirtId ~= "" then local shirt = Instance.new ("Shirt") shirt.ShirtTemplate = "rbxassetid://3301088562" .. shirtId shirt.Parent = character end
if pantsId ~= "" then local pants = Instance.new ("Pants") pants.PantsTemplate = "rbxassetid://3301091053" .. pantsId pants.Parent = character end end) end)
Players.PlayerRemoving:Connect(function(player) -- Сохраняем ID одежды при выходе if player.Character then local shirt = player.Character:FindFirstChildOfClass("Shirt") local pants = player.Character:FindFirstChildOfClass("Pants")
if shirt then player:SetAttribute("ShirtId", shirt.ShirtTemplate:match("rbxassetid://(.+)")) end
if pants then player:SetAttribute("PantsId", pants.PantsTemplate:match("rbxassetid://(.+)")) end end end)
Players.PlayerAdded:Connect(function(player)
-- Создаем таблицу для хранения информации об одежде
player:SetAttribute("ShirtId", "")
player:SetAttribute("PantsId", "")
-- Восстанавливаем одежду при входе
player.CharacterAdded:Connect(function(character)
local shirtId = player:GetAttribute("ShirtId")
local pantsId = player:GetAttribute("PantsId")
if shirtId ~= "" then
local shirt = Instance.new ("Shirt")
shirt.ShirtTemplate = "rbxassetid://3301088562" .. shirtId
shirt.Parent = character
end
if pantsId ~= "" then
local pants = Instance.new ("Pants")
pants.PantsTemplate = "rbxassetid://3301091053" .. pantsId
pants.Parent = character
end
end)
end)
Players.PlayerRemoving:Connect(function(player)
-- Сохраняем ID одежды при выходе
if player.Character then
local shirt = player.Character:FindFirstChildOfClass("Shirt")
local pants = player.Character:FindFirstChildOfClass("Pants")
if shirt then
player:SetAttribute("ShirtId", shirt.ShirtTemplate:match("rbxassetid://(.+)"))
end
if pants then
player:SetAttribute("PantsId", pants.PantsTemplate:match("rbxassetid://(.+)"))
end
end
end)