Click here to Skip to main content
15,890,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone
I am trying to make the lights on a police car keep flashing, but the while loop I am using does not work.

The Output shows that the wait loops does not function, and I have used print statements to see where the issue was. Please help

What I have tried:

local blue = script.Parent.Blue
local red = script.Parent.Red

--Flashing lights
while true do
	red.Material = "SmoothPlastic"
	red.SpotLight.Brightness = 1
	blue.Material = "Neon"
	blue.SpotLight.Brightness = 3
	print('Blue Lights Activated')
	wait(2)
	print('Waiting Procedure')
	wait(0.1)
	red.Material = "Neon"
	red.SpotLight.Brightness = 3
	blue.Material = "SmoothPlastic"
	blue.SpotLight.Brightness = 1
	print('Red Lights Activated')
end

local blue = script.Parent.Blue
local red = script.Parent.Red

--Flashing lights
for i=1, 1000 do
	red.Material = "SmoothPlastic"
	red.SpotLight.Brightness = 1
	blue.Material = "Neon"
	blue.SpotLight.Brightness = 3
	print('Blue Lights Activated')
	wait(2)
	print('Waiting Procedure')
	wait(0.1)
	red.Material = "Neon"
	red.SpotLight.Brightness = 3
	blue.Material = "SmoothPlastic"
	blue.SpotLight.Brightness = 1
	print('Red Lights Activated')
end
Posted
Updated 22-May-21 4:52am

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900