Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I save Brick and Color3 Values? [EDITED]

For some time I've been making a customizer script for my game

I've been working with JSON to save my tables, but it seems unable to encode or decode Color Values, and when the color values are in a table, they simply set to nil.

I'm using Data Persistence, since players may update and load their data many times in a session.

Does anyone know a work around?

Forgot to mention, I'm saving multiple colors at a time, stored in a table.

2 comments

0

You should be able to save it as a string.

0

You'd think, but I'm getting either errors or nil values in return.

1 answer

✓ Accepted answer

Data Saving of either any doesn't play kindly with ROBLOX userdata.

The easiest way to save a Color3 is to convert it to a table:

local Color3Tab = {Color3.r, Color3.g, Color3.b}

Which will then easily save.

To get the Color3 back:

local Color3 = Color3.new(Color3Tab[1], Color3Tab[2], Color3Tab[3])

1 comment

0

Works, Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.