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

color changing script is stuck on black?

Asked by 3 years ago
Edited 3 years ago

so what im trying to do is making a kind of flashing neon brick. its suppose to go black then blue then keep looping (changes after 1 second)

im getting no error heres the script

local loopingPart = script.Parent

while true do
    loopingPart.BrickColor = BrickColor.new(0, 0, 0)
    wait(1)
    loopingPart.BrickColor = BrickColor.new(13, 105, 172)
end

im still new to scripting.

please and thank you

2 answers

Log in to vote
0
Answered by 3 years ago

Your script is doing exactly what you ask it to do. Keep in mind when making while loops that there is no delay before it restarts itself. What its currently doing is starting the loop, changing the bricks color value to (0,0,0), waiting 1 second, changing it to (13,105,172), then before you can see the color change immediately changing it back to (0,0,0) as there is no wait in place.

To fix this you could add a wait after the second color change, or as i did below turn it into a while wait loop instead of while true.

local loopingPart = script.Parent

while wait(1) do
    loopingPart.BrickColor = BrickColor.new(0, 0, 0)
    wait(1)
    loopingPart.BrickColor = BrickColor.new(13, 105, 172)
end
0
thank you this helped. MrBloxyPixel 4 — 3y
Ad
Log in to vote
0
Answered by
abrobot 44
3 years ago
Edited 3 years ago

This is the 120,000 questions!!!!

Answer this question