Hey. So I have been having this problem lately, and can’t get much done with this error constantly showing up…
So it says this:
Game1.lua:188: attempt to locate index ‘sceneGroup’ (a nil value)
stack traceback:
Game1.lua:188: in function ‘_listener’
and this is line 188:
sceneGroup:insert(box4[i])
Which is in this code:
local function spawnDemBowxes4() local sceneGroup = self.view local Fall = math.random( display.contentWidth \* -0.2, display.contentWidth \* 1.2 ) -- this is the new function.. add it.. add a sceneGroup .. try different places box4[i] = display.newImageRect( "box2.png", 38, 38 ) box4[i].x = Fall box4[i].y = -200 sceneGroup:insert(box4[i]) box4[i].collision = onCollision box4[i]:addEventListener( "collision", box4[i] ) transition.to( box4[i], { rotation = box4[i].rotation+720, time=15000, onComplete=spinImage } ) physics.addBody( box4[i], "dynamic" ) box4[i].gravityScale = 0.6 end local function delayTimer() box4Timer = timer.performWithDelay( 500, spawnDemBowxes4, -1 ) end delayTimer = timer.performWithDelay( 25000, delayTimer, 1 )
Keep in mind that I have plenty more that are exactly the same as this, but this, is the one that is giving me the error…