Left click detection in spectator mode

I made this menu that uses an invisible slime to detect when the player left clicks (I use the entity being spectated as a trigger). It resets instantly so it mostly works well, but sometimes there's this bobbing effect that happens when you stop spectating.

I think it's impossible to get rid of it (if not, please tell me how), so I'm looking for another method to detect left click in spectator mode.

Continue to help post