Hello,
I added if what checks if the zombie isn’t nil, but it still give error after zombie gets deleted.
if(zombie) then
zombie.x = zombie.x + 2
end
And this is function where zombie is deleted
if zombie.hp <= 0 then
Runtime:removeEventListener("enterFrame", enemy)
timer.performWithDelay(1, function()
zombie:removeSelf()
end)
end