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

how to make a day and night ambience work, and repeat?

I have a script in my game that allows smooth day and night, I also figured I could add a day/night ambience. however, the script does work in game. But. only the day ambience plays and the night will not, and I wish to have this play every day and night.

I have a current placeholder until I figure out how to use this script.

do 
game.Workspace.Day:Play()
wait (600)
game.Workspace.Day:Pause()

game.Workspace.Night:Play()
wait (600)
game.Workspace.night:Pause()
end

2 comments

0

Is your day ambiance set to loop? Because ROBLOX audio only lasts 120 seconds and you have a wait of 600 seconds, so if it isn't set to loop then the audio will end after 120 and wait another 480 secodns to play the night

0

They now allow longer audio sizes.

1 answer

Use a while true do loop. It runs forever, which you want in your case.

while true do 
	game.Workspace.Day:Play()
	wait (600)
	
	game.Workspace.Night:Play()
	wait (600)
end

Also, I'm assuming your audio you want to play is 600 seconds long. As long as the property Loop is not enabled, you do not have to stop it.

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