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

How do I use "while"?

Asked by 9 years ago

This is my short amount of coding

function ot() script.Parent.BrickColor = BrickColor.new("Bright red") script.Parent.Transparency = .5 wait(0.25) script.Parent.BrickColor = BrickColor.new("Institutional white") script.Parent.Transparency = .5 end script.Parent.Touched:connect(ot)

I figured out how to make it so that when touched, these bricks change colors. Not too hard. The problem comes when I decide that I don't want to just have as a one time function, but rather I would like it to constantly be the 2nd color while there is something touching the brick.

I found my solution in "while", but I don't know how to implement it into this appropriately. Please help.

Answer this question