how do i make this code work?

local function HearSoundNearDeath()
	if (LocalPlayer():Health() < 10) then
	surface.PlaySound( "death.wav" );
hook.Add( "Health", "PlayerHurt", HearSoundNearDeath )

thank you for your answers :smiley:


im trying to make a code that plays a sound when you health is below 10 and it will only play 1 time and not repeat.

There is no hook Health, replace it with PlayerShouldTakeDamage

okay i will try that :slight_smile: , thanks


did not work :frowning:

Where are you placing the file?

in the cl_init.lua in my gamemode