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

What's wrong with my color changing script?

If you remember me a month ago, I knew nothing about lua. Now I know a lot more.

Okay anyways, back to my question. I'm trying to make a color changing brick, and what's wrong with this script?

while true do

change = game.Workspace.Part --Part is the brick I'm trying to change.

change.BrickColor = BrickColor.new "Really red"
wait(1)
change.BrickColor = BrickColor.new "Lime green"

end

1 answer

This is just a simple logical error, we change the block to Really red then wait 1 and change it to Lime green but we do not wait so we change it to Really red. As not enough time has passed we cannot see the change.

We simple need another wait (keeping the code simple):-

while true do

-- we only need to get this once so there is no need for it to be in the loop.
change = game.Workspace.Part

change.BrickColor = BrickColor.new "Really red"
wait(1)
change.BrickColor = BrickColor.new "Lime green"
wait(1) -- we wait again

end

I hope this helps.

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