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

How to script a pause in between looped audio?

Asked by 5 years ago

Hi! So my problem is I have a short audio clip I want to play in the game I'm making, but the loops are too fast. I've experimented a bit myself but haven't come up with a solution. Here's the script I'm using:

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://177529588"
sound.Parent = game.Workspace.Cross
sound.Volume = 1.6
sound.Looped=false
sound.PlaybackSpeed = 3
sound:play()

Thanks!

0
It’s sound:Play(), not sound:play(). Where does it say to use :play()? User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You can do this by using the .Ended event on the sound.

When the sound ends, the Ended event will fire. We can make the script wait then play the audio again when the event fires.

Here's an example of how you would do it :

local Sound = SomeHierarchyIdk:WaitForChild('Sound')

Sound.Ended:Connect(function()
    wait(1) -- This will delay the loop
    Sound:Play()
end)
Ad

Answer this question