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

Problems with ZIndex?

Asked by
drew1017 330 Moderation Voter
9 years ago
01local HUD = Instance.new("ScreenGui")
02HUD.Parent = script.Parent
03 
04local BackHUD = Instance.new('ScreenGui')
05BackHUD.Parent = script.Parent
06 
07local Backframe = Instance.new('Frame')
08wait(1) -- this isn't the problem if you're wondering
09Backframe.Parent = BackHUD
10Backframe.Position = UDim2.new(0, 25, 0, 25)
11Backframe.Size = UDim2.new(0, game.Players.LocalPlayer.Character.Humanoid.MaxHealth / 5, 0, 25)
12Backframe.ZIndex = 1 --
13Backframe.BackgroundColor3 = Color3.new(0.35, 0.35, 0.35)
14 
15local frame = Instance.new("Frame")
View all 28 lines...

As you can see each of these frames have a ZIndex which should make it show in order of the text, frame (grey) and backframe (dark grey), but Backframe covers the others anyway. Any ideas?

0
Maybe try changing ALL the ZIndex's at the very end of the script. I don't know. I'd at least try that. Sometimes roblox does stupid things with instances -.-. ObscureEntity 294 — 9y
0
#sweetpea11fir Didn't work. drew1017 330 — 9y
0
Check to see if the ZIndex of the BackHUD is lower then the ZIndex of the HUD Prohibetur 70 — 9y
0
ScreenGui's dont have ZIndex, color, position etc properties like Frames. drew1017 330 — 9y
View all comments (4 more)
0
On line 25,why are you using BrickColor for a Color3 value? woodengop 1134 — 9y
0
Did that before i knew what a Color3 was and forgot to change it. I changed it and it still doesen't work. drew1017 330 — 9y
0
BrickColor only works on Bricks. woodengop 1134 — 9y
0
But they have a property, Color, that returns their Color3. That part of his code is fine. Idk about the ZIndex thing. Sometimes if your arrange the guis in the order you want them (in the explorer), they will over-lap each other correctly, so I would try that. Perci1 4988 — 9y

1 answer

Log in to vote
0
Answered by
xAtom_ik 574 Moderation Voter
9 years ago

Your problem is that, they are not in the same screengui, so it isn't doing the ZIndex

Try putting them in the same gui

01local HUD = Instance.new("ScreenGui")
02HUD.Parent = script.Parent
03 
04local Backframe = Instance.new('Frame')
05wait(1) -- this isn't the problem if you're wondering
06Backframe.Parent = HUD
07Backframe.Position = UDim2.new(0, 25, 0, 25)
08Backframe.Size = UDim2.new(0, game.Players.LocalPlayer.Character.Humanoid.MaxHealth / 5, 0, 25)
09Backframe.ZIndex = 1 --
10Backframe.BackgroundColor3 = Color3.new(0.35, 0.35, 0.35)
11 
12local frame = Instance.new("Frame")
13frame.Parent = HUD
14frame.Position = UDim2.new(0, 25, 0, 25)
15frame.Size = UDim2.new(0, game.Players.LocalPlayer.Character.Humanoid.Health / 5, 0, 25)
View all 25 lines...
Ad

Answer this question