My GUI code won’t work!

HELP!!! My code won’t work!!

So my code is simple; click a button to make a GUI appear.

local Equip = game.StarterGui.Gui1.Equip
script.Parent.MouseButton1Click:Connect(function()
Equip.Visible = true
If Equip.Visible == true then
print(“Visible”)
else
print(“Not”)
end
end)

Please Help! My output says it’s visible when it’s not :frowning:

You’re using StarterGui rather than PlayerGui, change

local Equip = game.StarterGui.Gui1.Equip

To

local Equip = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui").Gui1.Equip

Or go back up via script.Parent.Parent… and so on till you reach it

1 Like

It also should be a local script if it isn’t already, since it’s dealing with a player’s gui.

This is not the category for you to ask people to solve your problem. Go to #help-and-feedback:scripting-support.

Make sure this is a local script.

local player = game.Players.LocalPlayer
local equip = player.PlayerGui.Gui1:WaitForChild("Equip")

script.Parent.MouseButton1Up:Connect(function()
    equip.Visible = true
    print("Visible")

    if not equip.Visible then   
        print("Not Visible")
    end
end)
1 Like

It is a LocalScript already. I did at first use a normal script but I changed it to a LocalScript.