So I recently started learning about hooks, and I am trying to make it so when you die, it plays a sound.
resource.AddFile("sound/deathinversion.mp3") local InvDeathSound = ("deathinversion.mp3") local function PlayerDeath() surface.PlaySound( "deathinversion.mp3" ) end hook.Add( "PlayerDeath", "SoundOnPlayerDeath", PlayerDeath)
So what my problem is, I am getting an error saying something along of the lines of “surface is a nil value”
I tried using BroadcastLua, but, it played every time anyone died.
I’m not a good coder in anyway (as you can see), so if anyone could help me or point me in the right direction it would be appreciated.