local HUD = Instance.new("ScreenGui") HUD.Parent = script.Parent local BackHUD = Instance.new('ScreenGui') BackHUD.Parent = script.Parent local Backframe = Instance.new('Frame') wait(1) -- this isn't the problem if you're wondering Backframe.Parent = BackHUD Backframe.Position = UDim2.new(0, 25, 0, 25) Backframe.Size = UDim2.new(0, game.Players.LocalPlayer.Character.Humanoid.MaxHealth / 5, 0, 25) Backframe.ZIndex = 1 -- Backframe.BackgroundColor3 = Color3.new(0.35, 0.35, 0.35) local frame = Instance.new("Frame") frame.Parent = HUD frame.Position = UDim2.new(0, 25, 0, 25) frame.Size = UDim2.new(0, game.Players.LocalPlayer.Character.Humanoid.Health / 5, 0, 25) frame.ZIndex = 2 -- local textLabel = Instance.new("TextLabel") textLabel.Parent = HUD textLabel.Position = UDim2.new(0, 25, 0, 25) textLabel.Size = UDim2.new(0, 25, 0, 25) textLabel.BackgroundColor3 = BrickColor.White().Color textLabel.BackgroundTransparency = 1 textLabel.Text = game.Players.LocalPlayer.Character.Humanoid.Health textLabel.ZIndex = 3 --
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?
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
local HUD = Instance.new("ScreenGui") HUD.Parent = script.Parent local Backframe = Instance.new('Frame') wait(1) -- this isn't the problem if you're wondering Backframe.Parent = HUD Backframe.Position = UDim2.new(0, 25, 0, 25) Backframe.Size = UDim2.new(0, game.Players.LocalPlayer.Character.Humanoid.MaxHealth / 5, 0, 25) Backframe.ZIndex = 1 -- Backframe.BackgroundColor3 = Color3.new(0.35, 0.35, 0.35) local frame = Instance.new("Frame") frame.Parent = HUD frame.Position = UDim2.new(0, 25, 0, 25) frame.Size = UDim2.new(0, game.Players.LocalPlayer.Character.Humanoid.Health / 5, 0, 25) frame.ZIndex = 2 -- local textLabel = Instance.new("TextLabel") textLabel.Parent = HUD textLabel.Position = UDim2.new(0, 25, 0, 25) textLabel.Size = UDim2.new(0, 25, 0, 25) textLabel.BackgroundColor3 = BrickColor.White().Color textLabel.BackgroundTransparency = 1 textLabel.Text = game.Players.LocalPlayer.Character.Humanoid.Health textLabel.ZIndex = 3 --