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

On death, play a sound?

Hi, you've probably noticed that in ROBLOX Studio, in Soundscape, there is now "StockSound" objects. I want to use the sound "Victory" every time a player dies.

I've tried this:

function OnDeath()
	print("Death")
	game.Soundscape.Victory:play()
end

But it doesn't seem to work.

Any help would be appreciated. Thanks!

3 answers

✓ Accepted answer

must be in a local script

local player = game.Players.LocalPlayer

function Death()
print('Death')
game.Soundscape.Victory:play()

if player.Character.Humanoid.Health == 0 then
Death()
end

1 comment

0

Thanks!

Can't Help

But you need to define what OnDeath is like

Function ondeath if player.humanoid.health = 0 then Game.soundscape.Victory:play()

But you need to define what player is

You would put the local script into the StarterPack. Hope that helps.

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