[Resolved] Really big problem.

Hello, I’m in final stage of development of my game, and I have a serious bug that seems that cannot be fixed.

This is the problem,

I have the character variable(which contains an image), called pers.

It has a initial X and Y value, and changes every frame.
The stage ends when the timer goes zero(from 60, a minute), and then it goes back to the stage selection screen again. The problem is, if I go back to the game, the character will not move anymore, and then the error appears:

“attempt to concatenate field ‘x’ (a nil value)” - this is when I tried to PRINT the pers.x, if I remove that print, the error is

“attempt to perform arithmetic on field ‘x’ (a nil value)”

The problem is, when I print before the pers.x and pers.y BEFORE the game starts, it shows a number, but when the game itself starts, it somehow changes to nil, which I didn’t coded at all.

Please help, I need to solve this problem to end this game asap.
[import]uid: 69287 topic_id: 24246 reply_id: 324246[/import]

That usually means that the object is not there or those values are not being added to the object. Are you creating the object using an init() function that sets everything up? Typically when you go back to a scene you will have to recreate everything again and again. [import]uid: 63800 topic_id: 24246 reply_id: 98027[/import]

Yeah, thanks for the help, I forgot to mention, but 1 hour after I posted it, I found the solution.

I was not unactivating the Runtime function, so, when I go back to the very same scene, it would have 2 local variables called Pers, and the one that was being attributed was not the right one. I just coded to remove the Runtime event, and then the bugs are gone!

Thank you! [import]uid: 69287 topic_id: 24246 reply_id: 98034[/import]