Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make the script play the music louder on death?

I have this script that plays a certain death music when you die, but it is too quiet. I want to add a volume increase to the script but it doesn't work.

local IDs = {
	3242409200,784747919,4134880887,4930282522,2946037756,1838457617,6234792983
}
local Random_ID = string.format("rbxassetid://%d", IDs[math.random(#IDs)])
local dead = script.Parent.HumanoidRootPart:WaitForChild("Died")

dead.SoundId = Random_ID

After I tried to increase the volume but doesn't work:

local sound = Instance.new("Sound", game.Workspace)
sound.Volume = 10

local IDs = {
	3242409200,784747919,4134880887,4930282522,2946037756,1838457617,6234792983
}
local Random_ID = string.format("rbxassetid://%d", IDs[math.random(#IDs)])
local dead = script.Parent.HumanoidRootPart:WaitForChild("Died")

dead.SoundId = Random_ID

2 answers

Try checking the humanoid state or checking if the health = 0

Try using the Humanoid.Died event to connect a function where it changes sound value

This discussion is preserved as it was. New answers, comments, and votes are closed.