Ok, thank you for at least trying to help ^^ now, below is the script i made, (not good at scripting, just started)


script.Parent.Parent.Character.Humanoid.HealthChanged:connect(function()
Death = math.random(1,4)
if Death == 2 then
script.Parent.Parent.Character.Head.Hurt1:Play()
elseif Death == 3 then
script.Parent.Parent.Character.Head.Hurt2:Play()
elseif Death == 4 then
script.Parent.Parent.Character.Head.Hurt3:Play()
else
end
end)

What the script should do is: when the humanoid/character dies, the script shall play a random death sound which is placed in their head body part.

Although there was a warning called Global 'Death' is only used in the enclosing code.

Then I tried the script, and it did not work.

Thank you for reading!

3 comments

0

Have you tried renaming the 'Death' variable?

0

is it in a sever or local script?

0

Sorry for the late reply! Yes, i did turn "Death" into a local variable, however it did not work. It was placed in a script, not a local script.