I have a GUI for my game, but I want to make a fade effect. I have a frame that covers the entire screen, with a ZIndex of 2. The menu GUI has a ZIndex of 1 (all descendants). The frame won’t appear on top of the other GUI. They are in separate screenGUIs.
If I place this fade frame inside the same screengui as the menu, it will then appear on top of the menu.
Was ZIndex changed to only be calculated inside a screengui? ZIndex doesn’t work between ScreenGuis for me.
ZIndex only functions within a ScreenGui – outside of that, it draws them based on the order they are in the explorer AFAIK. It happens for the same reason ZIndex of SurfaceGUIs don’t function between each other – it’d just be too much of a hassle to keep track of that when it really didn’t matter that much in the first place. If you want that overlay to appear on top, you’re going to have to keep it within the menu’s ScreenGui.
How the hell have I used this feature since it was released, but never noticed this.
Why would it be done this way. To calculate the render order, they need to compare the ZIndex’es anyways, why not just grab everything inside the PlayerGui instead of working per-screengui? (I’m sure there’s some technical reason).
Anyhow, thanks. I figured I was missing something.
Probably for the same reason you can make a GUI completely on ZIndex 1 and have everything displayed properly. Since outside of ZIndex rules, GuiObjects are displayed over other GuiObjects that were instantiated earlier than they were, you’d never notice an issue if you’re creating them in the order that they need to appear (which you typically do anyway)
I’m not exactly sure on the issue – perhaps it could be that they don’t want to add the extra work for the renderer to do, or perhaps the render code is in the GUI itself which doesn’t have access to anything above the ScreenGui – I don’t know. It shouldn’t be that much of an issue though. Is there something preventing you from putting the two in the same ScreeGui?