How to stop a function while colliding with the character

I glad you did it sir!

Good Luck!