Can you set a value for ZIndexBehavior within a script?

Hi everyone!

So, small question, can you do what I’ve said in the title? I’ve tried looking at the documentation for it, it’s a little vague. I’ve tried to set it doing:

ScreenGui.ZIndexBehaviour.EnumType = Enum.ZIndexBehavior.Global
ScreenGui.ZIndexBehaviour.Value = 0
ScreenGui.ZIndexBehaviour.Name = "Global"

None of these worked. You may ask, why is this necessary for me? Well, I am currently making a UI that consists of a viewport and 2 CanvasGroups.

What happens when the ScreenGui is set to Global:

The viewport works fine but the GroupTransparency property of both CanvasGroups do not work, because it’s overwritten by ScreenGui.

What happens when the ScreenGui is set to Sibling:

The viewport becomes glitchy, though the GroupTransparency of the CanvasGroups works just fine. What do I do? Thanks :slight_smile:

You almost got it right, it is without EnumType.
ScreenGui.ZIndexBehaviour = Enum.ZIndexBehavior.Global
To see if it worked in LocalScript you need to go in Explorer (Players>“PlayerName”>PlayerGui>“GuiName”) and see the properties, but if you are using an normal Script just see it in the StarterGui

2 Likes

gosh dangit LOL well thank you! it worked pretty well! I suppose it was a silly mistake haha :slight_smile:

2 Likes

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