Changing a table to be color3 values

User.FavouriteColor = {107, 184, 217} -- can't be Color3 as it's a data store

User.FavouriteColor = color.r, color.g, color.b

I don’t get any errors when changing it, but if I then do

print(unpack(User.FavouriteColor))

I get
bad argument #1 (table expected, got number)

This is the same as User.FavouriteColor = color.r. You’re just setting it to the first value, not all three. The solution you’re probably looking for is to put all three in a table, which you can do easily: User.FavouriteColor = {color.r, color.g, color.b}

1 Like

Problem I’m getting is I’m using fromRGB, so

User.FavouriteColor = {107, 184, 217}
print(unpack(User.FavouriteColor)) -- prints 107, 184, 217

is the RGB numbers.
But if I do

User.FavouriteColor = {color.r, color.g, color.b}
-- then...
print(unpack(User.FavouriteColor)) -- prints 1 0.57254904508591 0.87450987100601

I need it to change to each individual number and not /255

Can you not just multiply by 255 to reverse the division?

User.FavouriteColor = {color.r*255, color.g*255, color.b*255}
1 Like

I could get issues with numbers not being exact.

107.00000882149 184.00000423193 217.00001746416

You could just math.floor or round it.

1 Like