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

Make it so this sound plays once when you swim in water?

Asked by 5 years ago
Edited 5 years ago

I'm trying to make a sound play when you're swimming in water, but when I do it plays it even though it's already playing which makes an unwanted effect.

wait(1)
local P = game.Players.LocalPlayer
local character = workspace:WaitForChild(P.Name)

local s = Instance.new("Sound", P.PlayerGui)
s.SoundId = script.Underwater.SoundId

P.Character.Humanoid.Swimming:Connect(
    function()
        s:Play()
        end
)
0
Wait, so the problem is that the sound already plays when the character isn't swimming, and it plays again when the player starts swimming? ScrubSadmir 200 — 5y
0
So when you go idle the sound plays like normal, but when you are swimming then it keeps playing over and over starting from the begging  CaptainAlien132 225 — 5y
0
Try adding an if statement to see if the sound is playing. CrystallineShard 47 — 5y
0
just add if s.IsPaused then Warfaresh0t 414 — 5y
0
Just make a bool and make it false b4 u enter water and true when youre in water lol LightModed 81 — 5y

Answer this question