Weird behavior with tostring() with Color3, returns wrong numbers

local TestColor = Color3.fromRGB(255, 255, 255)

local Splits = tostring(TestColor):split(',')
print(Splits[1])
print(Splits[2])
print(Splits[3])

It prints 1 three times, not the actual number (255). I need to turn it into a string before splitting.
So, any ideas how to bypass this odd behavior?

1 Like

Update -

The splits table looks like this apparently, when printed:

[1] = "1",
[2] = " 1",
[3] = " 1"

Whatever is going on, it’s surely annoying and weird.
And yes, I’m aware the 1 is representing a number from the Color3.new(), not fromRGB.

1 Like

It appears that that 1 is a representation of 100% usage of the RBG respectively, probably just how they designed it to function. If you want to get the specific value you’ve set from there you could just multiply the output by 255.

I took your code and changed the value to 7, 255, 255 and got 0.027450980618596077, 1, 1
With that multiplying them all by 255 got the final value, the 7 did come out to 7.000000057742 but you can round that out

3 Likes

That’s interesting… but true.
I was able to get the number by multiplying the numbers with 255, and somehow it works.
Thank you very much. :slight_smile: