how do i make this code work?

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

thank you for your answers :smiley:

[editline]09:43PM[/editline]

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

[editline]09:46PM[/editline]

did not work :frowning:

Where are you placing the file?

in the cl_init.lua in my gamemode