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

Why my script (which should be simple ... I guess ...) about changing color does not work?

Asked by 5 years ago

Here my script

while true do
    script.Parent.BrickColor = BrickColor.new(0, 255, 0)    
    wait(2)
    script.Parent.BrickColor = BrickColor.new(255, 0, 0)
end

1 answer

Log in to vote
0
Answered by 5 years ago

The problem is very simple. After the second change on line 4, you didn't add another wait call after it, so it instantly went to line 2 and made it seem like it didn't change. The fix is to add a call to the wait function after line 4.

while true do
    script.Parent.BrickColor = BrickColor.new(0, 255, 0)    
    wait(2)
    script.Parent.BrickColor = BrickColor.new(255, 0, 0)
    wait(2)
end


0
Oh.... Yeah, i forgot it ;_; dingding2002 14 — 5y
0
By the way, say you're trying to make something red. Don't you do something like BrickColor.new("Really red") instead of an RGB value? Chardinok 5 — 5y
0
That's perfectly fine. User#19524 175 — 5y
Ad

Answer this question