Issue with an if statement

I was working on this short little project and then suddenly when I added one simple if statement that should work, it just doesn’t work. Any idea why? TTT meta function btw

hook.Add("PlayerDeath", "Monitor", function(ply)
if ply:HasEquipmentItem( EQUIP_MONITOR ) then
print("It worked!")
for k,players in pairs(player.GetAll()) do
CustomMsg(players, ply:Nick() .. "'s death has been confirmed due to him having a heart beat monitor!", Color(255,0,0))
ply:SetNWBool("body_found", true)

Also no lua errors. Even if I try the EQUIP_RADAR and when I have it, doesn’t work.

that singular ’ in your Custom Message seems like it might potentially fuck shit up

I’m uncertain, try getting rid of it and see if that changes anything

[editline]8th March 2014[/editline]

and if that solves it, put it back with a


No, the ’ shouldn’t be doing anything, but

this is run when a player dies: ply:StripAll()

So it removes all of his equipment, so he doesn’t have the EQUIP_MONITOR anymore, because hes dead.

PlayerDeath is a standard call; it’s supposed to be SERVER-side. Make sure the hook is being run, if a return is in another hook which is called before this one then it may not get to it. Move the print statement outside of the first if. Print out the result of the HasEquipmentItem. Indent your code.

I could just do a quick timer
EDIT: It worked. I just did a quick timer on the ply:StripAll().

I don’t like doing it :v: