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

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

Asked by
TechModel 118
3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by
3F1VE 257 Moderation Voter
3 years ago

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

Ad
Log in to vote
0
Answered by 3 years ago

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

Answer this question