How to make a script where one UI is always above another? (On Y axis)

I want to make this UI…

Always above this backpack module UI. No matter the screen size or aspect ratio.

I tried making a script repositioning the captures UI above the backpack UI and it never seemed to work no matter what I did with scale, offset etc.

I don’t think there’s a problem with the backpack module itself, it looks like guy was smart and always parented after setting properties. I did waitforchild etc

I’d be extremely grateful if someone wrote this script so I can lazily plug in and play. But seriously, I’d like to learn from it because I don’t understand right now.

However, I don’t really want something more complex than one script that I can copy and paste and put all my GUIs in. This leads me to a more philosophical question…

Is it actually possible to have a nice UI for all players?


Oh, what a lovely UI, with anchor point .5,.5, converted to scale, and with a UIAspectRatioConstraint. All the standard tips people give for a consistent sized UI. Now let’s see what was done in Roblox Studio to create this…


AHHH! CURSES! Get that away from me this instant!

Or am I just uninformed and this isn’t actually philosophical at all?

zindex for guiobjects
DisplayOrder for screenguis

4 Likes

You don’t need a script to do this, try with the Zindex property.

https://devforum.roblox.com/t/what-is-zindex-behaviour/1200087

2 Likes

Ty. I mean above like on the Y axis

2 Likes

Are you looking for A UI like this?

1028

Phone

Or, something like this;

Phone

Laptop

Try setting anchor point to (0.5, 1) and setting position at x(0.5, 0) y(1, -H), H being the height of the backpack.
No scripts needed.

You could also parent them to the same frame and position the frame with anchor point (0.5, 1) and position x(0.5, 0) y(1, 0), this is what i did to keep my hotbar config above my hotbar.


image

1 Like

The backpack is a module. I don’t want to go into the module and mess with that. So it will require a script.

You mean the Y position?
image
How should I convert this to pure offset first? (Parent is frame)

Oooh, so the backpack is created via script too ? Anyway, do u have control over what’s gonna be the backpack’s parent ?
If so I believe my second suggestion is the more consistent one.

Sorry for not catching that on ur post ! It should work if you change the anchor points from (0.5, 0.5) to (0.5, 1) tho.

1 Like