Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

the zindex for a gui is 101 and the other is 23 and the one with 23 is overlaying?

Asked by
MEWTLC 0
3 years ago

Ive tried setting the zindex by scripting as well as using the explorer, but it is not working. Here is the script I used: game.StarterGui.ScreenGui.Barsoutline.ZIndex=101 -- bars outline is an image label game.StarterGui.ScreenGui.Barsoutline.ImageLabel.ZIndex=23

0
is clip descendants on? misha123 83 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

When the game initializes, all the contents of StarterGui go to the PlayerGui which in the explorer is located under game.Players.playerName.PlayerGui if this is a local script, you can use this to access the PlayerGui: game.Players.LocalPlayer.PlayerGui. So emplementing that into your script:

local player = game.Players.LocalPlayer

local playerGui = player:WaitForChild("PlayerGui")

playerGui.ScreenGui.Barsoutline.ZIndex = 101
playerGui.ScreenGui.Barsoutline.ImageLabel.ZIndex = 23

Hope this fixed your problem!

0
It should also be noted that you should get the service rather than call it directly, as that is good practice + the fact that not all services load instantly on game load. Do `game:GetService("Players")` in one line, and call `LocalPlayer` in the next. Slydexic 20 — 3y
0
Using :GetService() ruins intellisense lol User#32819 0 — 3y
Ad

Answer this question