I'm making a skin colour changer. It has a datastore and it saves the skin color that you choose to the datastore and changes skin color. When you rejoin the game it should spawn as the last skin colour you chose because it saves to datastore, but when I try to change the Character's body parts to that piece of data it says: Color3 wanted, got string.

game.Players.PlayerAdded:Connect(function(plr)
    local col =  plr:WaitForChild("Stats").Color.Value
	local char = plr.CharacterAdded:Wait()
	local colour = tonumber(col)

    char.Head.Color = colour 
    char.Torso.Color = colour 
    char["Left Leg"].Color = colour
    char["Left Arm"].Color =  colour
    char["Right Arm"].Color =  colour
    char["Right Leg"].Color =  colour
end)

That's my current script for that.

This is what saves it to the datastore and this works fine:

local DataStore2 = require(1936396537)

game.ReplicatedStorage.Events.ColourEvent1.OnServerEvent:Connect(function(plr, colour)
	
	local colorDataStore = DataStore2("color", plr)
	local char = plr.Character
	local colour2 = tostring(colour)
	
	colorDataStore:Set(colour2)
	
	char.Head.Color = colour
	char.Torso.Color = colour
	char["Left Leg"].Color = colour
	char["Left Arm"].Color = colour
	char["Right Arm"].Color = colour
	char["Right Leg"].Color = colour

end)

I have eight different colour types, and when you click it, it will fire event and send the background colour to the script. Then it saves to datastore. When a player leaves and rejoins it should make the skin colour what that datastore value is. (the colour)

4 comments

1

@Bluesteelkid, you can save the color as a RGB value saving each individually.

1

@Bluesteelkid or if you want BrickColors, you can save the name as a string

0

I'm assuming that plr:WaitForChild("Stats").Color.Value is a color3 value?

0

Color3.fromRGB(red,green,blue) may help you i guess (?)