Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make a part change color rapidly??

Asked by 6 years ago

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.

0
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 Gameplayer365247v2 1055 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

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

01function random()
02    num1 = math.Random(1,255)
03    num2 = math.Random(1,255)
04    num3 = math.Random(1,255)
05end
06 
07while true do
08    random() -- this calls the function
09    game.Workspace.Part.Color = Color3.new(num1, num2, num3)
10    wait(100)
11end

Of course the way simpler way to do it with less colors is

1while true do
2     
3    game.Workspace.Part.BrickColor = BrickColor.Random()
4    wait(100)
5     
6end

Hope this helps!!

Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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.

0
yeah but I read that only gives like 64 colors I want all 16,581,375 colors. lukebinno 53 — 6y

Answer this question