How do I make sounds play when the player reaches to the certain hp? doing While True do works but rapidly plays the sound which I don't want at all. I'm stuck and I want to get some help to help me solve this solution.
local player = game.Players.LocalPlayer local Character = player.Character or player.CharacterAdded:Wait() local s = Character:WaitForChild("Humanoid") wait() if s.Health <= 40 then end -- Sound Play script.Parent.Sound:Play() script.Parent.Sound2:Stop() if s.Health >= 50 then -- Sound Stop script.Parent.Sound:Stop() script.Parent.Sound2:Play() end
If the sound is looped then uncheck it. If not then do this:
local player = game.Players.LocalPlayer local Character = player.Character or player.CharacterAdded:Wait() local s = Character:WaitForChild("Humanoid") wait() if s.Health <= 40 then -- Sound Play script.Parent.Sound:Play() script.Parent.Sound2:Stop() if s.Health >= 50 then -- Sound Stop script.Parent.Sound:Stop() script.Parent.Sound2:Play() end end