Gui Tweening | Hiding based on window size

What I’m trying to do is just neatly tuck away a GUI with tweening, that way the button is only visible, not the main frame itself, kinda like a File Folder. The problem I’m having is depending on the window size the button could be too far in or completely gone all together.

What can I do so just the button is not clipped or missing? (button moves when re-sized)

1 Like

Actually I managed to fix it:

local mouse = game.Players.LocalPlayer:GetMouse()
ViewSizeX = mouse.ViewSizeX
Neg = (ViewSizeX/2) - GUISize
UDim2.new(-0.5,Neg,0,0)

1 Like

I see you’ve solved it, but it’s not very elegant and if your GUIs force you to use solutions like that you’re probably in for more difficulties in the long run. Do you use offsets for your GUI sizes?

Modify your UI so that the x component of the anchorpoint of that background frame is 1 (anchored to its right, i.e. 1,0, or 1,.5, whatever you need to do). Then to slide it in, you simply tween the X position of that frame to {0,0}.

1 Like

That’s a even better solution, Thanks!

I never even knew the Anchorpoint existed in Roblox Guis till now.