Need help saving color3 values to datastores

  1. What do you want to achieve? Keep it simple and clear!
    im trying to make a game and im trying to make character customization to save
  2. What is the issue?
  3. What solutions have you tried so far? -
    i tried looking at some topics but i need help understanding most of the stuff needed to save color3 values to my data store

heres my code

local players = game:GetService("Players")
local datastore = game:GetService("DataStoreService")
local datastore1 = datastore:GetDataStore("leaderstat2")
local datastore2 = datastore:GetDataStore("customize")

players.PlayerAdded:connect(function(player)
	local folder = Instance.new("Folder")
	folder.Name = "leaderstats2"
	folder.Parent = player
	
	local tutorial = Instance.new("BoolValue")
	tutorial.Name = "Tut"
	tutorial.Parent = player.leaderstats2
	tutorial.Value = datastore1:GetAsync(player.UserId) or false
	datastore1:SetAsync(player.UserId, tutorial.Value)
	
	local shirt = Instance.new("Color3Value")
	shirt.Name = "Shirt"
	shirt.Parent = player.leaderstats2
	shirt.Value = datastore2:GetAsync(player.UserId) or Color3.fromRGB(86, 36, 36)
	datastore2:SetAsync(player.UserId, shirt.Value)
	
	tutorial.Changed:connect(function()
		datastore1:SetAsync(player.UserId, tutorial.Value)
	end)
	
	shirt.Changed:connect(function()
		datastore2:SetAsync(player.UserId, shirt.Value)
		end)
	
end)

You cannot store Color3s directly into the datastore. What you’d have to do is to probably store them as their individual RGB values into the datastore. Example

shirt.Changed:connect(function()
	datastore2:SetAsync(player.UserId, {shirt.Value.R,shirt.Value.G,shirt.Value.B})
end)

And then you’d have to fix your code around to make it work with a system like this

You cannot save Color3 datatype to datastore, what you will have to do is save a table with the parameters.

Example

local color = {90,90,90}
--save "color" to datastore

--then when you retrieve color from the datastore you can do 
local newcolor = Color3.new(color[1],color[2],color[3])

i never used tables before in lua so im pretty much confused here

Make a table and put the rgb values in something like this

local datastoreservice = game:getservice("datastoreservice")
local yourdatastore =  data store stuff

local R = color3.new(red color)
local G = color3.new(blue color)
local B = color3.new(green color)

local RGB = {R,G,B}

yourdatatsore:setasync(playerid,rgb)

to get the value its quite easy

loca rgb = nil
local success,fail = pcall(function)
rgb = yourdatastore:getasync(playerid)
end)

rgb[1] = red
rgb[2] = blue 
ect

ive found a different method to do this thanks for the help!