So i am trying to create a in game menu. I am able to create my menu when clicking my pause game button. this is all great until i want to close out my menu and go back to playing the game. here is what i have happening in my close menu function:
local closeMenuBtn
local closeMenuBtn = function ( event )
if event.phase == "release" then
menubg:removeSelf() ; menubg = nil
replayBtn:removeSelf() ; replayBtn = nil
LevelSelectBtn:removeSelf() ; LevelSelectBtn = nil
closeMenuBtn:removeSelf() ; closeMenuBtn = nil
physics.start()
end
end
i always get the error: attempt to index upvalue ‘closeMenuBtn’ (a nil value)
i can’t figure it out, i have looked at the monsters vs zombies example and this is how they do it also. Anyone have any ideas of how to do this? it just seems to not want to destroy the button that i just used to start the removeself function…
[import]uid: 19620 topic_id: 7281 reply_id: 307281[/import]