npcs is a table
[CODE]for k, v in pairs(npcs) do
NPC:AddRelationship(v.." D_LI 99")
end[/CODE]
[CODE]
[ERROR]gamemode/init.lua:138: attempt to index local 'NPC' (a nil value)
[/CODE]
I keep getting this error can anyone explain why? Thanks
[highlight](User was banned for this post ("undescriptive thread title" - postal))[/highlight]
Try using NPC:AddEntityRelationship instead.
Im still getting the same error :/
[CODE]for k, v in pairs(npcs) do
local npc = ents.Create(v)
NPC:AddEntityRelationship( npc ,D_LI, 99)
end[/CODE]
Not sure whether it'll make a difference but the comma seems out of place here: ( npc ,D_LI, 99) maybe change it to ( npc, D_LI, 99)
Sorry, you need to Log In to post a reply to this thread.