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 5 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 — 5y

2 answers

Log in to vote
1
Answered by 5 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

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!!

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 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 — 5y

Answer this question