If the sprite doesn’t show/hide with the mouse then I’d guess your collision shape isn’t signaling to this function. If you are still using a CharacterBody2D make sure it’s mouse_entered and exited signals are connected to this script.
When pasting it will look better when between three ticks ``` (not quotes)