What do you want to achieve? A random color picker that chooses one color from a table out of 4
What is the issue? Math.random returns the same color until player leaves
What solutions have you tried so far? i tried using random.new and it didnt work.
Here is my random color picker script:
local colors = {
Color3.fromRGB(255, 255, 255); --white
Color3.fromRGB(255, 94, 239); -- pink
Color3.fromRGB(209, 203, 255); -- pastel
Color3.fromRGB(170, 255, 255); -- cyan
}
local color = colors[math.random(1, #colors)]
print(color) --print is not main code just for demonstration
The one you posted yes, it does, here it is:
Unable to assign property Color. Color3 expected, got number
here is the line that caused the error
L.Color = color
It still returns the same exact value, but this time it’s red
here is the output and the script im currently using `local colors = {
“255, 255, 255”; --white
“255, 94, 239”; – pink
“209, 203, 255”; – pastel
“170, 255, 255”; – cyan
}
local color = math.random(1, #colors)
local colors = {
Color3.fromRGB(255, 255, 255); --white
Color3.fromRGB(255, 94, 239); -- pink
Color3.fromRGB(209, 203, 255); -- pastel
Color3.fromRGB(170, 255, 255); -- cyan
}
local index = math.floor(Random.new():NextNumber(1, #colors))
local color = colors[index];
print(index)
print(color) --print is not main code just for demonstration
Yeah I get that but we can’t really fix code we can’t even see.
Leave out everything unrelated to the color and send the script if you can.
The color not changing until the module is run again when the player rejoins would literally mean the variable isn’t being updated even if you’re saying it is.