local DataStore = game:GetService(“DataStoreService”):GetDataStore(“ClothingSave”)
function Save(Chr, Plr)
local face
for i,v in pairs(Chr.Head:GetChildren()) do
if v:IsA("Decal") then
face = v
end
end
local information = {
["Shirt"] = Chr.Shirt.ShirtTemplate;
["Pants"] = Chr.Pants.PantsTemplate;
["Face"] =face.Texture
}
DataStore:SetAsync(Plr.UserId, information)
end
function Load(Chr, Plr)
local good, info = pcall(function()
return(DataStore:GetAsync(Plr.UserId))
end)
print(Plr.Name, "DataStoreRetrivalInformation", good, info)
for i,v in pairs(Chr.Head:GetChildren()) do
if v:IsA("Decal") then
v.Texture = info.Face
end
end
Chr.Shirt.ShirtTemplate = info.Shirt
Chr.Pants.PantsTemplate = info.Pants
end
game.Players.PlayerAdded:Connect(function(Plr)
local Char = Plr.CharacterAppearanceLoaded:Wait()
Load(Char)
end)
game.Players.PlayerRemoving:Connect(function(Plr)
Save()
end)