So I have a settings script and a client script, my settings script code is as follows;
local module = {}
function module.GetPresetColours()
local table_PresetColours = {
255,255,255, -->> Note how this one isn't a string.
'255,255,252',
'255,255,255',
'255,255,255',
'255,255,255',
}
return table_PresetColours
end
return module
I want to fetch this script and all the preset colours on the client. My client code is below;
local root = workspace.MoodLighting
local Settings = require(root.Main.Settings)
print(Settings.GetPresetColours()[1])
script.Parent.preset1.Preview.ImageColor3 = Color3.fromRGB(Settings.GetPresetColours()[1])
When I run this code, it prints 255 instead of the expected 255,255,255 and also changes the image to 255,0,0 which is not what I expected but yeah.
So basically is there a way to silence commas to stop it from returning to the next line or do I have to do string.match stuff?

9 comments
Use a semi-colon.
What do you mean, like put it at the end instead?
{255, 255, 255; "255, 255, 255", "255, 255, 255"}
Why are you using a String anyway? You can always typecast with tostring() if needed.
If I use a number it returns at 255 so the value is 255 instead of 255,255,255. I also tried tonumber() but it's not a number because it contains commas.
tostring() wouldn't work because it's not a number in the first place
Fair.
Color3.fromRGB needs integers for their arguments, not strings. That's why it's not working at all. I recommend looking into string.split and then using that in conjunction with tonumber.
Also, since your code is only putting in the numbers for the first value, R, you're getting 255,0,0. When values are left blank in Color3.fromRGB, the blank values default to 0. Your code is basically doing fromRGB(255), so the other 2 arguments default to 0 to get 255,0,0.