[Resolved] Problem removing groups

Okay, this is new. Don’t think I’ve ever run into this before.

In one of my functions, I have created several groups.  I am able to manipulate those groups within the function using .isVisible without any issue.

But when I try to remove the groups using :removeSelf() I get an error:

Attempt to index global ‘CategoryMenuGroup’ (a nil value)

This occurs whether I put those calls in the same function, or at the start of another external function that is called by the function.

What would cause this?  What should I look for?

I figured out what this was.

I was incorrectly adding two identical event listeners to the button that moves the player on from that screen.  And since there were two listeners, the function that removed the group was firing twice. And the group had already been removed, so it couldn’t get removed a second time.

That seems odd that putting two identical event listeners will cause it to fire twice, but will make sure to not do that again.   :slight_smile:

I figured out what this was.

I was incorrectly adding two identical event listeners to the button that moves the player on from that screen.  And since there were two listeners, the function that removed the group was firing twice. And the group had already been removed, so it couldn’t get removed a second time.

That seems odd that putting two identical event listeners will cause it to fire twice, but will make sure to not do that again.   :slight_smile: