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

Script that puts a sound for when player dies?

Asked by 6 years ago

Hi, how would it be possible so that after HumanoidHealth reaches 0, the player who died gets a Sound to play, only for them? I don't think Humanoid.Died exists anymore so my only alternative is this. ^^^^

Thanks so much.

0
Lolw Humanoid.Died does exist. RubenKan 3615 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
-- localscript
local sound = ""
-- Please put the sound Id in the "" above.
game:GetService("Players").PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            local DeathSound = Instance.new("Sound", character.Head)
            DeathSound.SoundId = sound
            DeathSound.Volume = 1
            DeathSound.MaxDistance = 10000000000000000
        end)
    end)
end)

the died function still exists

if it doesn't exist then do this..

-- localscript Again....
local sound = ""
-- Please put the sound Id in the "" above.
game:GetService("Players").PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid"):connect(function()
            if character.Humanoid.Health.Value < 1 then
                local DeathSound = Instance.new("Sound", character.Head)
                DeathSound.SoundId = sound
                DeathSound.Volume = 1
                DeathSound.MaxDistance = 10000000000000000
            end
        end)
    end)
end)

There you go, you asked for it... Have fun

Ad

Answer this question