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

How do i make a loop?

How do I make a loop for lights so every second they turn on, then off? Please help!
it comes up with this

SpotLight is not a valid member of Part

1 answer

✓ Accepted answer

you would use a while loop:

local Timetowait = 1
while wait(Timetowait) do
	if script.Parent.SpotLight.Enabled == true then
		script.Parent.SpotLight.Enabled = false
	else
		script.Parent.SpotLight.Enabled = true
	end
end

2 comments

0

You could use script.Parent.SpotLight.Enabled = not script.Parent.SpotLight.Enabled

0

Umm ok?

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