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

Flashing light depending on time??

I've got a light and a day / night script but I want the light to only come on and start flashing at certain times and stop at a certain time...

Here is part of my day / night script (Not sure if its needed to fix my problem)

while true do
game.Lighting.TimeOfDay = "12:00:00"
wait(60)
game.Lighting.TimeOfDay = "13:00:00"
wait(60)
game.Lighting.TimeOfDay = "14:00:00"
wait(60)
game.Lighting.TimeOfDay = "15:00:00"
wait(60)
game.Lighting.TimeOfDay = "16:00:00"
wait(60)
game.Lighting.TimeOfDay = "17:00:00"
game.Lighting. Ambient = Color3.new(95 / 255, 95 / 255, 95 / 255)

And it keeps going till it reaches a full cycle and then re-starts... This works fine, Its just my flashing light that dosent work. Heres my script:

while true do
	wait (60)
	if game.Lighting.TimeOfDay >= "17:30:00" then
		repeat script.Parent.PointLight.Enabled = true
			wait (2)
			script.Parent.PointLight.Enabled = false
			
		until game.Lighting.TimeOfDay >= "08:30:00"
		script.Parent.PointLight.Enabled = false
	
	end
end

Its located in Workspace - Ship - Light and also in the part of 'Light' is the PointLight but it dosent pulse on and off with 2 second delay until the time of 08:30:00 is reached, it's always on... If anyone could help, I would be very thankful...

Thanks in advance =)

1 answer

You never make game.Lighting.TimeOfDay >= "17:30:00" true. It goes to "17:00:00" then goes back to 12:00:00. It's always on because you never trigger the if loop and by default it is on.

2 comments

0

Hope it helps

0

Nope, I've eddited the script to include 17:30:00 and 08:30:00 and it dosent make any difference. Thanks for trying though

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