Issue with enlarging gui on hover

Not every single gui. Just the ones that are scalable that you don’t want to move around

If I change the anchor point will it change my actual position

In a script, probably. Outside of the game, no.
Think of AnchorPoint as the origin, and your button is being dilated from the origin.

My button already has a set position so if I set the anchor point to 0.5,0.5 will it change the pos?

Make the Anchor point .5,.5
You will see it will change the Position, Thats okay just bring it back to the original position

If you mean the button itself, no. The anchor point, yes.

as seen in the video why is the gui button a bit to the right?

Set the anchor point of the Gui object to the exact center beforehand (and don’t change it) so it doesn’t move when you resize it.

Set a variable at the beginning of the main script for the default size of the Gui, so that it’s easier to make the size exactly what you want.

DO:

local OriginalSize = UDim2.new('DEFAULT SIZE')
local NewSize = UDim2.new('HOVER SIZE')

Gui.MouseEnter:Connect(function()
      Gui.Size = NewSize
end)
Gui.MouseLeave:Connect(function()
      Gui.Size = OriginalSize
end)

DON’T:

Gui.MouseEnter:Connect(function()
      Gui.Size = Gui.Size + UDim2.new()
end)
Gui.MouseLeave:Connect(function()
      Gui.Size = Gui.Size - UDim2.New()
end)

Edit: Also don’t set the original size variable as Gui.Size, because it will update as you resize it.

1 Like