How can I save a Color3 value with Datastore2?

I was confused when my value wasn’t saved when I rejoined the game. I didn’t realize that you couldn’t save a color3 value. How would I go about getting around this?

game.ReplicatedStorage.CharacterRemotes.ColorChange.OnServerEvent:Connect(function(player, color2)
	
	local DataStore2 = require(game.ServerScriptService.DataStore:WaitForChild("DataStore2"))
	local PointsStore = DataStore2("Tone", player)

	PointsStore:Set(color2) 
	player.PlayerGui.AvatarCreator.SkinTone.SkinTone.Value = color2
	player.Character["Body Colors"].HeadColor3 = color2
	player.Character["Body Colors"].LeftArmColor3 = color2
	player.Character["Body Colors"].LeftLegColor3 = color2
	player.Character["Body Colors"].RightArmColor3 = color2
	player.Character["Body Colors"].RightLegColor3 = color2
	player.Character["Body Colors"].TorsoColor3 = color2
end)

You could just store a String value of the RGB values of the color3, so it would look like this for example:
255-255-255
Then you could just use string.gsub(...) to parse the color values and use tonumber(...) to convert them to numbers, then you would do Color3.fromRGB(<color 1>, <color 2>, <color 3>) to create your color.

2 Likes

Can u give an example please i need it so much