Gui visible, but is not there

Made a class selection screen, I have health bars and stuff so I made them visible = false. But when you choose your class I made my script make them visible (The health bars and stuff) Even though it says it is visible, you cant see the bars. (And yes the ZIndex is higher)

During selection: (The bars is that square thing)


After selection:

As you can see, gone.

This is the script:

local MainFrame = script.Parent.MainFrame

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage.ClassChosen

local Vampire = MainFrame.Vampire
local Human = MainFrame.Human

local VampireInfo = MainFrame.VampireInfo
local HumanInfo = MainFrame.HumanInfo

local Player = game:GetService("Players").LocalPlayer

local HumanClass = Player:WaitForChild("Classes"):WaitForChild("Human")
local VampireClass = Player:WaitForChild("Classes"):WaitForChild("Vampire")

local MainFrame2 = game:GetService("StarterGui").Bars.MainFrame




Vampire.MouseButton1Click:Connect(function()
	local VampireChosen = "Vampire"
	Event:FireServer(VampireChosen)
	MainFrame.Visible = false
	MainFrame2.Visible = true
end)

Human.MouseButton1Click:Connect(function()
	local HumanChosen = "Human"
	Event:FireServer(HumanChosen)
	MainFrame.Visible = false
	MainFrame2.Visible = true
end)

Vampire.MouseEnter:Connect(function()
	VampireInfo.Visible = true
end)

Human.MouseEnter:Connect(function()
	HumanInfo.Visible = true
end)

Vampire.MouseLeave:Connect(function()
	VampireInfo.Visible = false
end)

Human.MouseLeave:Connect(function()
	HumanInfo.Visible = false
end)

whats the output? [ hello my name is irfan …]

i see , so the problem is “MainFrame2.Visible = true” right? you should do
player.PlayerGui[“Bars”].Enabled = true or frame Visible = true . that should work

You should be able to see this UI set to visible in the studio without the game running.
Try to do that 1st, then run it the way you wish to.

Also: you’re looking at the starterGui not the playersGui.
The StarterGui gets copied to the playersGui …

Change ZIndex to higher .t.t.t.t.t.t

I set the MainFrame2 variable to:

local MainFrame2 = Player.PlayerGui:WaitForChild(“Bars”).MainFrame

And it worked.

1 Like

Simple mistake you’ll never make again …

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