Hello, so i don’t know how can i save player skintone.
Here my code:
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("CharacterSaver")
game.Players.PlayerAdded:Connect(function(Player)
local Character = game.Workspace:WaitForChild(Player.Name)
local BodyColor = Instance.new("BodyColors", Character)
BodyColor.Name = "Body Colors"
local Shirt = Instance.new("Shirt", Character)
Shirt.Name = "Shirt"
local Pants = Instance.new("Pants", Character)
Pants.Name = "Pants"
local GetTable
local success, errormessage = pcall(function()
GetTable = myDataStore:GetAsync(Player.UserId)
end)
if success then
Player.Character.Head.face.Texture = GetTable.Face
Player.Character.Shirt.ShirtTemplate = GetTable.Shirt
Player.Character.Pants.PantsTemplate = GetTable.Pants
else
print("An error when loading data!")
end
end)
game.ReplicatedStorage.SaveEvent.OnServerEvent:Connect(function(Player)
local SaveTable = {
Shirt = Player.Character.Shirt.ShirtTemplate;
Pants = Player.Character.Pants.PantsTemplate;
Face = Player.Character.Head.face.Texture;
}
local success, errormessage = pcall(function()
myDataStore:SetAsync(Player.UserId, SaveTable)
end)
if success then
print("Player Data successfully saved!")
else
print("An error when saving data!")
warn(errormessage)
end
end)