Color doesn't save Player's NameColor using Color3Value in DataStore

Hello, so I’m trying to make a system that allow players change their overhead color name, I made it to work, but the problem is that it doesn’t save in the Datastore so when the player rejoin the game they have their Name Color already changed.

NameColor stat in Leaderstats & Datastore script
image

Datastore
image

Data supposed to save when player leaving
image

The Error

Does anybody know how to fix this please? :pleading_face:

You need to serialize the data into a datastore compatible format, i.e; by representing the value via the primitive Lua data types and then later deserialize that data when loading it.

When saving:
NameColor = {Player.NameColor.Value.R, Player.NameColor.Value.G, Player.NameColor.Value.B}
When loading:
NameColor.Value = Color3.new(table.unpack(Data.NameColor))

You can also use Lua’s global function unpack() instead of table.unpack(), whichever you prefer.

well im trying to make it Color3.fromRGB, because this is what players use to change their color name
image

In that case replace Color3.new() to Color3.fromRGB(), providing the values being saved are between 0-255 and not 0-1.

I tried to use this
image

but now I get this.

I tried your method too but it didn’t work.

I’m not sure what you did (wasn’t shared) but you did something incorrectly.

Here, if this was the unshared image.
image

I just wanted to save the player’s color3.fromRGB number into their data. Its not possible?

This doesn’t relate to the saving or the loading.

You need to wipe the datastore (or use a different datastore name) because with the proposed fix you’d be saving/loading data differently.

I think this might be a little beyond your scope.