How do I put my own death sound for each player when they die?

I want to put my own death sound in my game. I wanted to replace the oof sound with something different. I don’t know how to put the sound on every player though. If you know how to please reply. Thank you!

2 Likes

When Humanoid.Died is invoked create a sound and play it.

Here is a tutorial by JesusLovesUsAll777:

The code in this tutorial isn’t the best but it works fine and gets the idea across.

9 Likes

In order to properly play the sound without the oof sound playing over it, you need to set the Died sound’s SoundId to whatever sound you would want to play instead. All sounds are stored in HumanoidRootPart. Creating a sound when the player dies will cause the sounds to overlap.

5 Likes

i am a rookie scripter but i think it would be a local script in starterpack going like this.

plr = game.Players.LocalPlayer
char = plr.Character

char.HumanoidRootPart.Died.SoundId = (“soundID”)

please correct me if i am wrong because i want to learn! :grin:

2 Likes

There is a LocalScript responsible for handling the sounds of all characters called RbxCharacterSounds and it is found in StarterPlayerScripts. Fork this script using the play solo session method and then change the id accordingly in the script itself.

You can also use CollectionService to tag all newly added characters and then use a tag-binding function in order to replace the Died sound. How you choose to tag characters is your own discretion but for the tag-binding function, it’d look something like this:

local function bindFunctionToTag(tag, callback)
    CollectionService:GetInstanceAddedSignal(tag):Connect(callback)

    for _, tagged in ipairs(CollectionService:GetTagged(tag)) do
        callback(tagged)
    end
end

bindFunctionToTag("Character", function(character)
    local root = character:WaitForChild("HumanoidRootPart")
    root.Died.SoundId = "rbxassetid://1337"
end)
6 Likes

@colbert2677 Thank you I did not know all these things and I will take them into account! :grin:

4 Likes

Wh- what?

Since when could exploiters kill everyone with only a LocalScript? They need server access. LocalScripts are a necessity for many things in Roblox nowadays.
The only time you should be concerned is when you are letting a LocalScript get to have authority over Server Scripts, via RemoteFunctions that are poorly set up.

2 Likes

It’s very very simple. Let me show you how :smile:

To replace the oof sound, you just need to type in

character.Head.Died.SoundId = "rbxassetid://YourIDHere"

Be sure to use the player:PlayerAdded and player:CharacterAdded events!

By the way, you can not only change the death sound, but for example also the Freefalling sound.

character.Head.FreeFalling.SoundId = "rbxassetid://YourIDHere"

I hope I was able to help you out!

4 Likes

Uhh, first up, that has nothing to do with this script. And 2nd thing: Exploiters need a server script to make the changes global.

And exploits don’t work like that. LocalScripts are needed in the games. Exploiters use injectors to mess with the code of ROBLOX. Meaning that it has nothing to do with your game, but rather with ROBLOX itself. Of course, you can pervent exploits using anti-exploit scripts, but as a normal game developer, there’s nothing you can do about that.

3 Likes

Please read posts more carefully before offering them responses. One month later and this response has nothing to do with the content of my post in question.

Not only is a client incapable of replicating death on other characters, but RbxCharacterSounds by default, injected by the engine, is a LocalScript. It is intended to handle sounds for all characters through a zero-network solution. Announcement thread here.

This post has already been long since resolved so unless you’re actually contributing new content, I don’t think it would be wise to continue the discussion. You can raise any issues to me in PMs if you’d like, although there wouldn’t be much since this is an old post. :slight_smile:

3 Likes