[ERROR] addons/keypading/lua/weapons/adv_keypad_cracker/shared.lua:157: Tried to use a NULL entity!
1. GetPos - [C]:-1
2. unknown - addons/keypading/lua/weapons/adv_keypad_cracker/shared.lua:157
if self.target:GetPos():Distance(self.Owner:EyePos()) > 80 then
self.hacking = false
self:EmitSound("Breakable.Spark")
if SERVER then
net.Start("adv_keypad_cracker_hack_finish")
net.WriteEntity(self)
net.Broadcast()
end
end
Either `self.target` or `self.Owner` is a non existent entity, I'd guess it's `self.target`.
You didn't give much context which makes it hard to say for sure.
But it seems like "target" is returning nil, try adding this after the first if statement.
self.target != nil and
if you still get an error, try adding:
print(ifself.target:GetPos():Distance(self.Owner:EyePos()))
right before the code snippit you sent, then check the console and report back what it says before getting an error.
It's not nil, you'd be getting an `attempt to index nil error` instead of `Tried to use a NULL entity!` if that was the case.
Ah, that makes sense. Good on you for correcting my mistake and avoiding confusion for OP
Sorry, you need to Log In to post a reply to this thread.