• attempt to call method 'kill' (a nil value)
    2 replies, posted
My first time making a super basic melee weapon and can't kill anything with it. if ( IsValid( ent ) && ( ent:IsPlayer() || ent:IsNPC() ) ) then self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) ply:SetAnimation( PLAYER_ATTACK1 ) ply:EmitSound( HitSound ) ent:SetHealth( ent:Health() - 50) if( ent:Health() < 1 ) then ent:Kill() end
Are you running this on the client or server? Also putting this in a shared file without any filters for client or server could also cause this as the Kill function is not defined on the client, only the server.
It also could be that the Kill method only works on players and not NPCs
Sorry, you need to Log In to post a reply to this thread.