How to change anchor point of UI element while keeping the same position?

Oh, I forgot that the Scale property doesn’t always have the viewport size as the multiplier but the first GuiObject ancestor.

You should check if there is a GuiObject ancestor and if there is, assign to some variable the AbsoluteSize of that GuiObject. If there isn’t, you just assign workspace.CurrentCamera.ViewportSize to that variable.

local ancestorsize
local guiobjancestor = v:FindFirstAncestorWhichIsA("GuiObject")
if  guiobjancestor then
    ancestorsize = guiobjancestor.AbsoluteSize
else
    ancestorsize = workspace.CurrentCamera.ViewportSize
end

After that you replace the workspace.CurrentCamera.ViewportSize in your code with ancestorsize.

1 Like

it works!! Thank you so much for your assistance, if I could give you a medal I would!

1 Like