Tweening / UDim2 only working once

Hello! I’m making a menu for my game, and when the mouse hovers over the play or settings button I want them to move a bit. So I used tweening and udim2 and stuff but when my mouse enters, it does what its supposed to do same with making it leave, but the the second time I put it in, it does nothing. No output errors. EDIT: I did nothing to the code and now its not working on mouse leave

my code:

script.Parent.MouseEnter:Connect(function(x, y)
script.Parent:TweenPosition(UDim2.new(0.05, 0,0.5, -90))
end)

script.Parent.MouseLeave:Connect(function(x, y)
script.Parent:TweenPosition(UDim2.new(0.01, 0,0.5, -90))
end)

Can you help me? Thanks!

I recommend you completing the rest of the arguments needed by :TweenPosition and also make sure to set the override value to true since that will avoid the object getting stucked if you move the mouse so fast.

If you do those things, the script should work fine, also why are you getting the x and the y from the function if you’re not using them?

I probably sound like an idiot but, how do I set the override value? And what other arguments does :TweenPosition need?

You can check them all in this page about :TweenPosition. This is an example of the arguments you could use for your tween.

:TweenPosition(UDim2.new(0.05, 0,0.5, -90), Enum.EasingDirection.Out, Enum.EasingStyle.Cubic, .25, true)

If you read the page you will see that you can also call a callback function, but forget about that since you only need the arguments I have put above.