• Help (attempt to call method 'AddEntityRelationship' (a nil value))
    3 replies, posted
Why does this: hook.Add("PlayerDeath","YouGotRekt",function( victim, inflictor, attacker )     if(victim:IsPlayer() and victim:IsValid() and ACforget:GetInt() == 1) then         for k,v in pairs(ents.GetAll()) do             if(v:IsNPC() and v:IsValid() and v:GetClass() == "npc_citizen" and v:GetName() == "OnceAngry" or "VeryAngry") then                v:AddEntityRelationship(victim, D_NU, 99)              end         end     end  end) give me this: [ERROR] modname:56: attempt to call method 'AddEntityRelationship' (a nil value)   1. v - lua/modname.lua:56    2. unknown - lua/includes/modules/hook.lua:84
Okay, I fixed it myself
a nil value means its returning empty/nothing that is why you're getting that error.
This was the problem. I changed it to v:GetName() == "OnceAngry" or v:GetName() == "VeryAngry"
Sorry, you need to Log In to post a reply to this thread.