MouseLeave is nil

I am trying to make the camera tween to a certain position when hovering over a button, and tween back to the player after the mouse leaves the button.
The problem is that GuiObject.MouseLeave is “nil” and the function won’t trigger at all.

LocalScript Code (under GUI button)

I have tried making it an if statement that when the mouse leaves, it runs the code within. However, this if statement will run even if the condition isn’t met. I tried looking for support on the DevForum, yet I could not find any posts that would help.

Here is the output when the function is trying to run after the mouse leaves the button:
image
Here is what the code does as of right now:
https://streamable.com/hwl9q

After the tween is done and the mouse leaves, the function would not work, thus the code was quite literally broken. If anyone could help me with this, it would be greatly appreciated.

It is saying that the function is nil and it is. you have the onMouseLeft function in the onMouseHover function.

Alright, thanks a lot! I didn’t notice that earlier and it now works.

1 Like