Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

color changing script is stuck on black?

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

✓ Accepted answer

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

1 comment

0

thank you this helped.

This is the 120,000 questions!!!!

This discussion is preserved as it was. New answers, comments, and votes are closed.