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

How to play a sound at certain time of day?

Asked by
Paradoa 17
3 years ago
Edited 3 years ago

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.

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() ChristianTRPOC 64 — 3y
0
Just add a while loop on top of that and you're good. Also use Play() instead of Playing. Dovydas1118 1495 — 3y
0
Play() made the audio play over and over again without finishing. Playing = true did the job better Paradoa 17 — 3y

1 answer

Log in to vote
0
Answered by
Paradoa 17
3 years ago
while true do
    wait()
    if game.Lighting.ClockTime >= 19 then
        workspace.Hoot.Playing = true
        workspace.Crickets.Playing = true
    end 
end

Ad

Answer this question