Hi,
I'm trying to spawn an egg each 10-30 sec but here is an error :
[CODE][ERROR] lua/entities/chicken.lua:26: attempt to call field 'Create' (a nil value)
1. Eggs - lua/entities/chicken.lua:26
2. unknown - lua/entities/chicken.lua:35
[/CODE]
Here is my code in entities/chicken.lua :
[CODE]function Eggs(pos)
local e = ents.Create("egg")
e:SetPos(pos)
e:Spawn()
end
function ENT:Think()
if self.lastegg == math.Round(CurTime(),0) then
for i=1,1 do
print(i)
Eggs(self:GetPos()+Vector(0,30,0))
self.lastegg = math.Round(CurTime()+math.random(10,30), 0)
end
print("EGG!")
end
hook.Add("HUDPaint","curtime",function()
draw.SimpleText(math.Round(CurTime(),0),Default,500,0,Color(255,255,255,255))
draw.SimpleText(self.lastegg,Default,500,40,Color(255,255,255,255))
end)
end[/CODE]
My egg entity is in entities/egg.lua
Only call Eggs serverside.
<3
Sorry, you need to Log In to post a reply to this thread.