Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to save a Color3 value into data store?

Asked by 6 years ago

I've been wanting to know this for a while, do you have to serialize it?

2 answers

Log in to vote
0
Answered by
jotslo 273 Moderation Voter
6 years ago

While you cannot store a Color3 value in a datastore, you can store a table containing R, G and B values and then convert it back into a Color3 value.

Example:

local Colour = Color3.fromRGB(1, 2, 3)
local Table = {Colour.r, Colour.g, Colour.b}

Colour = Color3.fromRGB(Table[1], Table[2], Table[3])
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Looking at this page: http://wiki.roblox.com/index.php?title=Datastore_Errors

The 4th error down - "Cannot store non-json types in DataStore", states "Values must be one of the following: float, boolean, integer, a utf-8 String, or a list comprised of one or more of these types."

Based on that, it would be best to store a Color3 value as a list of 3 floats.

Answer this question