So I am making a game where coins fall from the sky and when they land they are supposed to wait for awhile and then fade and then they are supposed to be removed.
This is how I thought you might be able to do it:
local function coindestroy(event) if(event.phase == "ended" and alive == true) then local i = event.target.id transition.to( coin[i], { time=1000, delay = 500, alpha = 0.01, onComplete=function() coin[i]:removeSelf() --This is line 62 and where the error comes from coin[i] = nil end}) end end
However, that gives me an error right after the coin fades. It says, “attempt to index field “?”(a nil value)”
Its because I am trying to remove the coin that is being transitioned, right? How would one correctly do this?