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

How would i Play a sound when you get a kill?

Asked by 10 years ago

Im trying to make a game that plays a sound everytime you Kill somewone How Would i do this?

1 answer

Log in to vote
0
Answered by 10 years ago
game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
local s = Instance.new("Sound", player)
s.SoundId = "" --Sound ID here
s.Volume = 0.5 --Sound Volume, 0 to 1
s.Pitch = 1 --Sound Pitch
s:play()
wait(5)
s:remove()
        end)
    end)
end)
0
Please do not simply post code, explain the reason behind your answer, for if you don't, it does not help the user to understand the reason behind your answer, please add some kind of explanation. TheeDeathCaster 2368 — 10y
Ad

Answer this question