Hello! This is my first post here so sorry if I miss anything, and I'm very new to scripting.
I'm trying to make it so a GUI button's size changes on mouse hover and click. So far this part is working, except for one thing. I have put the exact parameters shown in the buttons property tag for its size in the script, yet when the script is fired through a mouse hover, it squashes into a different size and won't go back to it's normal size. I've tried even using the frame's dimensions instead, yet this hasn't helped.
Here is my script:
local btn = script.Parent local isHovering = false btn.MouseEnter:Connect(function() isHovering = true btn:TweenSize(UDim2.new(0.537, 0, 0.594, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true) end) btn.MouseLeave:Connect(function() isHovering = false btn:TweenSize(UDim2.new(0.517, 0, 0.574, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true) end) btn.MouseButton1Down:Connect(function() btn:TweenSize(UDim2.new(0.507, 0, 0.554, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true) end) btn.MouseButton1Up:Connect(function() if not isHovering then btn:TweenSize(UDim2.new(0.517, 0, 0.574, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true) else btn:TweenSize(UDim2.new(0.537, 0, 0.594, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true) end end)
And here is what the problem is: Size and Hovering Issue
Thanks for any help in advance! I'm expecting it to be an obvious solution that I'm just blind to-
I haven't tested this myself but I'm pretty sure you use the wrong size in your script. {0, 517}, {0, 574}
(the original size in your screenshot) is much different from {0.517, 0}, {0.574, 0}
(the size in your script) as far as gui size goes.