Loud speaker to play at a certain time

Hello,

So i’ve been trying to implement a loud speaker system which plays a tune at a certain time, however I have no Idea where to start, I’ve got the tune it’s self set up, I wanted it to play at 6:00am (ROBLOX time) since my game has a day/night cycle.

Any support would be very helpful.

Maybe you might want to have a loop within a server if you are going along your ingame time.

Sure on that, however a loop would carry on playing the tune, I only want it to play once at 6:00.

Try

local music = path.to.sound.object

while wait() do
    if game.Lighting.ClockTime == 6 then
        music:Play()
        wait(2)-- make sure it doesn't play again
    end
end

I edited it like so

local Sound = workspace.Siren.LowerSiren.Sound

while wait() do
if game.Lighting.ClockTime == 6 then
Sound:Play()
wait(2)
end
end

Does not seem to work


local Sound = workspace.Siren.LowerSiren.Sound

while true do
    if game.Lighting.ClockTime == 6 then
        Sound:Play()
        wait(Sound.TimeLength)
    end
    wait(0.03)
end

Try that.

Works now, thank you for the edit.

1 Like

@Ty_IsHomeSchooled @Nautium Instead of doing wait(0.03), you could use RunService.Stepped.

1 Like