I'm trying to make a while loop but it doesn't work!

Greetings,
A few days ago I was bored and decided to learn to code in lua, the first time I started watching some tutorials and then I tried to write something out of my head, I thought of a simple script that uses a while loop but I just don’t know what’s wrong with it. When I try to test the game the part changes color to red, but when I wait 1 second nothing happens. Could someone please help me? Thank you!
Here is the code:

while true do
	script.Parent.BrickColor = BrickColor.new("Really red")
	wait(1)
	script.Parent.BrickColor = BrickColor.new("Sea green")
end
1 Like

It changes from green back to red instantly, if you add another wait at the end of the loop it should work like you wanted

2 Likes

Oh wow, that worked! I didn’t know it was that simple. Thank you!

2 Likes