Hi, im making a custom function for E2 and in order to narrow down what the function finds i have included
[code] if ent:GetClass() == "gmod_wire_expression2" then [/code]
however this returns the error (the line of code above is on line 16):
sv: Expression 2 (generic): entities/gmod_wire_expression2/core/custom/emp.lua:16: attempt to call method 'GetClass' (a nil value)
I have already performed checks to see if the entity is valid so i know thats not the problem, if anyone can help me solve this problem it will be greatly apreciated!
This error message means that in this case ent is not a valid entity since it doesn't have the GetClass method. You might want to use ValidEntity(ent) first.
Hey, i added that and it still returned an error so i added:
[code]if(ValidEntity(ent)) then
self.player:ChatPrint("yes\n")
end [/code]
After adding that peice of code, it returns the error:
sv: Expression 2 (generic): lua\includes\util.lua:168: attempt to call method 'IsValid' (a nil value)
Show us more code.
Sorry, you need to Log In to post a reply to this thread.