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

How to play a sound at certain time of day?

I've tried using this script

if game.Lighting.ClockTime >= 19 then
	workspace.Hoot.Playing = true
	workspace.Crickets.Playing = true
end 

but the sound doesn't play. There's no output. Please help.

3 comments

1

If that's the whole script, then it'll only check the ClockTime once it's executed. Make sure it's always checking whether the Clocktime is >= 19 and if it is, workspace.Hoot:Play()

0

Just add a while loop on top of that and you're good. Also use Play() instead of Playing.

0

Play() made the audio play over and over again without finishing. Playing = true did the job better

1 answer

while true do
	wait()
	if game.Lighting.ClockTime >= 19 then
		workspace.Hoot.Playing = true
		workspace.Crickets.Playing = true
	end 
end

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