I would like to save player skincolor?

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)
3 Likes

You can’t save objects in datastores instead save the shirts id and the color3 value for the bodycolors

Not really possible if you’re attempting to save BrickColor/Color3 Values, although you could work-around it by looking at the other posts

Ok, I found this post: Color3Value will not save it works but the color doesn’t save. I don’t know why

I’m pretty sure BrickColor also have a number value called a palatteValue index. I can’t seem to find the exact page but you can find the number by doing BrickColor.Number

1 Like

Thank you so much for help it works.