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

How can I get something to flash lights after a certain amount of time?

I want to create a light in my game (like an alarm light) that flashes red after 60 seconds. I have created the spherical part and put 6 SurfaceLights inside of the part. I want to have it so they are not lit up with any surfacelights enabled until 60 seconds of the game having finished loading, then I want them to enable all 6 surface lights (One for every surface, Top, Front, Back, Left, Right, Bottom.) and then disable them after 1 second, I want them to repeat this for 15 minutes.(900 seconds.)

I also want at the same time the lights are first enabled for the script to play an audio of my choice (a roblox audio ID, it can be a seperate script I just need it to come on at the same time the flashes start).

Thanks for all the help.

Here is a link to an imgur picture of my sphere and the 6 surface lights in it. https://imgur.com/a/qfaB5k0

3 comments

0

This isn't a request site

0

I know but Im stuck on how to do this, I dont want it given to me I want people to walk me through it as I cant find it myself.

0

Sorry if I didn't specify

1 answer

You mean like every 60 seconds is flashes once?

If that's what you mean you would start by putting a serverscript inside the part

Then input this code (if you have any questions or errors, just ask)

Minutes = 0

function Flash()
	local Lights = script.Parent:GetChildren()
	for index, light in pairs(Lights) 
		light.Enabled = true
		wait(0.2)
		light.Enabled = false
	end	
end

while wait(60) do
	if Minutes <= 15 then
		flash()
		Minutes = Minutes + 1
		print('Complete!')
	else
		print('More than 15 minutes!')
	end
end

2 comments

0

Testing

0

I mean so that the script waits 60 seconds and then enables all the surfacelights inside the part and then 0.7 seconds later disables them, then 1 second later re enables the surfacelights and then again 0.7 seconds later disables them. I want this to be looped for 15 minutes. I hope this helps you see what Im trying to learn and be walked through

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