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

On death, play a sound?

Asked by 11 years ago

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:

1function OnDeath()
2    print("Death")
3    game.Soundscape.Victory:play()
4end

But it doesn't seem to work.

Any help would be appreciated. Thanks!

3 answers

Log in to vote
0
Answered by 11 years ago

must be in a local script

1local player = game.Players.LocalPlayer
2 
3function Death()
4print('Death')
5game.Soundscape.Victory:play()
6 
7if player.Character.Humanoid.Health == 0 then
8Death()
9end
0
Thanks! iRzPWNzr 20 — 11y
Ad
Log in to vote
0
Answered by 11 years ago

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

Log in to vote
0
Answered by 11 years ago

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

Answer this question