Hello everybody, as you can see the from the title, I’m trying to make an audio play again only after the audio finishes playing. Incase if you didn’t understand what I was trying to say, let me explain with more details. So I’m making a move where a player holds “R”, the player will perform a barrage, I’m trying to make a sound play for every second the player holds “R”. But the problem is, when the audio plays, the audio plays again before the played audio ends. How should I modify the script so that the audio only plays again after the played audio ends. You can see the script below, (Swift1 is the audio that I’m having a problem with). I apologise for my bad english.
-- Godly Strike
local BarrageNumber = 1
local barragecount = 0
function GodlyStrike()
--// Cooldown and Performing Check\\--
if GodlyStrikeCD.Value == true or PerformingAction.Value == true or Stunned.Value == true then return end
--// Applying the Changes\\--
PerformingAction.Value = true
GodlyStrikeCD.Value = true
local holding2 = true
mouse.KeyUp:Connect(function(Key)
if Key == "r" then
holding2 = false
end
end)
human.WalkSpeed = 14
human.JumpPower = 0
LoopedBarrage:Play()
rushsound:Play()
repeat
coroutine.resume(coroutine.create(function()
Swiftsfx1:Play()
Swiftsfx1.Ended:Wait()
end))
barragecount = barragecount + 1
damage(rightarm, rightarm.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5, 0.5, 0, 0.25, hrp.CFrame.lookVector * 0, "rbxassetid://580201163", 0.075, Color3.new(1, 1, 1), 6708523560, 1)
damage(leftarm, leftarm.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5, 0.5, 0, 0.25, hrp.CFrame.lookVector * 0, "rbxassetid://580201163", 0.075, Color3.new(1, 1, 1), 6708523560, 1)
--damage(torsohitbox, torsohitbox.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5, 0.5, 0, 0.25, hrp.CFrame.lookVector * 0, "rbxassetid://580201163", 0.075, Color3.new(1, 1, 1), 6708523560, 1)
damage(rightleg, rightleg.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5, 0.5, 0, 0.25, hrp.CFrame.lookVector * 0, "rbxassetid://580201163", 0.075, Color3.new(1, 1, 1), 6708523560, 1)
damage(leftleg, leftleg.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5, 0.5, 0, 0.25, hrp.CFrame.lookVector * 0, "rbxassetid://580201163", 0.075, Color3.new(1, 1, 1), 6708523560, 1)
wait(0.1)
until holding2 == false or Stunned.Value == true or barragecount >= 60
LoopedBarrage:Stop()
rushsound:Stop()
barragecount = 0
human.WalkSpeed = oldws
human.JumpPower = oldjp
--// Cooldown\\--
PerformingAction.Value = false
coroutine.resume(coroutine.create(function()
wait(15)
GodlyStrikeCD.Value = false
end))
end
Any kind of help would be appreciated.