First of all, you have a few bad habits in your code.
You should instead make a new variable with the Datastore’s name instead of setting the previous variable that had the service.
Here, you should use Player’s (or pleyer’s, as you for some reason use it) UserId, since names can change and I don’t think you want players to lose the “color” data you store.
Now, let’s see how you save a Color3 value (as RGB):
When encoding, it is pretty straight forward:
local Color = Color3.fromRGB(0,255,0)
Color = ("%s,%s,%s"):format(tostring(Color.R),tostring(Color.G),tostring(Color.B))
local Success,Error = pcall(function()
Datastore:SetAsync(tostring("Color_"..Player.UserId),Color)
end)
if not Success then warn(Error) end
And same for decoding:
local Color = nil
local Success,Error = pcall(function()
Color = Datastore:GetAsync("Color_"..tostring(Player.UserId))
end)
if not Color then Color = Color3.fromRGB(255,255,255) end
-- See, when the encoder saves the data, it's not saved as .fromRGB format. You need .new
Color = Color:split(",")
Color = Color3.new(tonumber(Color[1]),tonumber(Color[2]),tonumber(Color[3]))
Player.info.color.Value = Color
And there you go.
For the love of code, write your variables normally.