When Monster dies, Stop playing its loop sound and play a death sound

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a script that Plays a Death sound when my Monster dies and also have it stop playing its scary ambience sound when it dies.

  2. What is the issue? Include screenshots / videos if possible!
    I’ve tried several ways to make the death sound trigger as well as the other sounds to stop playing but nothing happens. I mainly try to use “if script.Parent.Humanoid.Health <0 then play the sound and stop the other sounds” but that doesn’t seem to work.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried looking through the free models and using their death scripts but still no avail. Even one that triggered if the humanoid left workspace didn’t seem to work.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Try using:

Monster.Humanoid.Died:Connect(function()
     -- play sound
end)

and for the loop do

repeat
-- loop contents
until Monster.Humanoid.Health <= 0
1 Like

I’m so happy wow it really was that simple. Thank you a million I got it to work!

I need to learn more about functions

1 Like

Hmmm It seems to only work once and then when the monster respawns the ambience sound play after her death. Weird. Verbatim here’s the script

Monster=script.Parent.Parent

Sound1=script.Parent.Parent.Parent.Head.Sound1

Sound2=script.Parent.Parent.Parent.Head.Sound2

Monster.Died:Connect(function()

script.Parent:Play()

end)

repeat

Sound1.IsPlaying=true

Sound2.IsPlaying=true

until Monster.Humanoid.Health <= 0

edit I got it to fix itself by changing IsPlaying to just Play()

You were likely just missing Sound1.IsPlaying = false or Sound1:Stop() from the script.

1 Like