Help in Looping image animation.

Hello! I'm still a bit a newbie in terms of common events and I need some help on how to remove the image after the event is finished.
(I'm bad at explaining so bare with me qwq)

~Context~​

I tried to do something like Omori using looping images instead of GIF and it work but the thing is, I couldn't remove the image when the character got transported and it stays like this:

Spoiler
Screenshot (135).png

Here's what I did​
Spoiler
Screenshot (138).png

Screenshot (139).png

Screenshot (137).png

Please help if there's any way to solve this or even a plugin to make things easier T^T...
You're erasing the picture in the loop event, which only runs when the switch is ON. You're turning the switch off. Plus there's also no way out of the loop in the loop event, which means it will never get to the erase command no matter what.
you want to put a variable inside that loop like so I called the variable loopcount when it hits 5 loops it should end the loop I haven't tested it so I'm not sure if your need to use <,>

Untitled-1.png
or better, put the event into a switch condition. and make sure that event
is ON at boot.

than an condition, if switch is ON, do you event,
else, erase image.

short and easy 🙂
Well, I've faced with the same problem... Trying to fix it with all this recommendations. Thanks to this forum for its existing.

Original thread: https://forums.rpgmakerweb.com/threads/help-in-looping-image-animation.150356/