Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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
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 ZeMeNbUiLdEr 104 — 6y
0
They now allow longer audio sizes. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question