Positiong Frame next to a Button in a UILayout

Hello,

I’m gonna keep this very simple and clear. I want to know how to position a frame beside a GuiObject that is within a UIGridLayout or UIListLayout like what is highlighted in red in the image below. I’ve looked around but haven’t found anything.

You can probably just parent a Stats frame to the button itself.

I’ve tried just but it seems to change the size of the frame drastically.

Could I see an example? I tend to use this method for my stats.

Sorry for the late reply. So I kinda have figured out that the issue is that when the size is set to scale, it changes within the button as u can see in this video.

I see. Try rescale the frame after parenting it to the button. I made a little test file so that you can experiment about with what I mean:
Stat_Test.rbxl (57.2 KB)
Tell me if you encounter any issues.

Thanks a lot. That seems to have worked on my UI.

I know I’ve marked this as a solution but I encountered a problem. So it seems that when I use ClipDescendents on a Scrolling Frame, it clips within that frame. I can’t set the ZIndexBehaviour to Global on the ScreenGui because it messes up all my other frames.

Well, if the ZIndexBehavior needs to be Sibling, I’d parent the Stats template to the GUI on creation and then I’d try to use AbsolutePosition and AbsoluteSize like so:


Of course, since this is all offset, afterwards I convert it back to scale. This guy explains it pretty well:

ViewportSize is a property of CurrentCamera. Since the template has a new parent, I needed to update some of the code. I converted the frame to Scale with this code:

local pos = obj.AbsolutePosition
local size = obj.AbsoluteSize
local abs_x = (pos.X+size.X)/viewport_size.X
local abs_y = pos.Y/viewport_size.Y
	
template_active.Position = UDim2.fromScale(abs_x,abs_y)

Code is pretty much rewritten. Here’s the place file containing the code if you want it:
Stat_Test_Final.rbxl (57.3 KB)

1 Like

This is exactly what I was looking for. I was trying to use the AbsolutePosition too but couldn’t figure out how to use it like this. Thanks a lot, I’ll mark this as the proper solution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.