I have tried to do: while true do game.workspace.part.Color = game.workspace.part.Color.Random() wait(100) end
But it never changes color, can someone tell me why? I have only been coding in Lua for a couple months on the dev wiki.
I have tried to do: while true do game.workspace.part.Color = game.workspace.part.Color.Random() wait(100) end
But it never changes color, can someone tell me why? I have only been coding in Lua for a couple months on the dev wiki.
Okay, so first of all "color" is not what you want. You want BrickColor. Color has 3 numbers so if you wanted you could do
function random()
num1 = math.Random(1,255)
num2 = math.Random(1,255)
num3 = math.Random(1,255)
end
while true do
random() -- this calls the function
game.Workspace.Part.Color = Color3.new(num1, num2, num3)
wait(100)
end
Of course the way simpler way to do it with less colors is
while true do
game.Workspace.Part.BrickColor = BrickColor.Random()
wait(100)
end
Hope this helps!!
You need to change it to brickcolor, you can't just say color. Also it's going to change every 100 seconds, since you said wait(100)
Here what I came up with.
while true do game.workspace.part.BrickColor = BrickColor.Random() wait(1) end
Change the wait to whatever you prefer.
yeah but I read that only gives like 64 colors I want all 16,581,375 colors.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
you also need to put the wait function way lower if you want it to change rapidly, as of right now its every 100 seconds