How to change settings of roblox died sound ? (global)

I know you can just make a local script in starterchar script but I want it to be global not just local

script.Parent.HumanoidRootPart.Died.RollOffMaxDistance = 50
script.Parent.HumanoidRootPart.Died.RollOffMinDistance = 5
script.Parent.HumanoidRootPart.Died.Volume = 0.3

Thanks :slight_smile:

You would need to loop through all characters in workspace or connect a CharacterAdded function
e.g :

-- loop through all the characters in the game

for _, player in pairs(Players:GetPlayers())do
	if player.Character then
		local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
		if humanoidRootPart then
			humanoidRootPart.Died.RollOffMaxDistance = 50
			humanoidRootPart.Died.RollOffMinDistance = 5
			humanoidRootPart.Died.Volume = 0.3
		end
	end
end

Players.PlayerAdded:Connect(function(player) -- check when a player is added
    player.CharacterAdded:Connect(function(character) -- check when their character is added.
        local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
        humanoidRootPart.Died.RollOffMaxDistance = 50
        humanoidRootPart.Died.RollOffMinDistance = 5
        humanoidRootPart.Died.Volume = 0.3
    end)
end)

This will work in a LocalScript or ServerScript

1 Like

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.

OR

There is a LocalScript responsible for handling the sounds of all characters called RbxCharacterSounds and it is found in StarterPlayerScripts.

This post by @colbert2677 explains this in detail.

2 Likes

Inside a LocalScript in game.StarterPlayer.StarterPlayerScripts:

local Players = game:GetService("Players")

function PlayerAdded(player)
	local function CharacterAdded(char)
		--wait for a maximum of 5 seconds for each
		local root = char:WaitForChild("HumanoidRootPart", 5) 
		if not root then return end 
		local Died = root:FindFirstChild("Died", 5)
		if not Died then return end 
		Died.RollOffMaxDistance = 50
		Died.RollOffMinDistance = 5
		Died.Volume = 0.3
	end
	CharacterAdded(player.Character or player.CharacterAdded:Wait()) 
	player.CharacterAdded:Connect(CharacterAdded)
end 

for i, player in pairs(Players:GetPlayers()) do 
	PlayerAdded(player)
end
Players.PlayerAdded:Connect(PlayerAdded)

The sound doesn’t exist on the server(for some reason) so I had to make it client side.

Edit: you may have to wait or change the sound properties multiple times.(maybe connect them to a property changed signal)

2 Likes