Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my GUI not popping up when I click a button?

I am currently having a problem where when i click a button it will not pop up the gui, please help:

local sd = game.StarterGui.SchoolShopGUI.DirtSwordInfo

script.Parent.MouseButton1Click:Connect(function()
	sd.Visible = true
end)

1 comment

0

StarterGui is a Server Replication Container. It’s contents are stored in another container called PlayerGui upon the Client loading. To actively modify the UI, you must reference PlayerGui instead.

2 answers

Try this.

local plr = game.Players.LocalPlayer
local sd = plr.PlayerGui.SchoolShopGUI.DirtSwordInfo

script.Parent.MouseButton1Click:Connect(function()
    sd.Visible = true
end)

Also, make sure this is a localscript.

1 comment

0

I did the exact thing and it did not work.

I don't see an error in the script unless what you're trying to set visible to true to is not a frame or anything without the property of "Visible". Maybe add wait() or WaitForChild

local plr = game.Players.LocalPlayer
wait()
local sd = plr:WaitForChild("PlayerGui"):WaitForChild("SchoolShopGUI").DirtSwordInfo

script.Parent.MouseButton1Click:Connect(function()
    sd.Visible = true
end)

1 comment

0

Please don’t use recursive methods, make a new variable for each set., or store the Script as a descendant of the respective GUI to eliminate load issues altogether. Following that example, apply script:FindFirstAncestor("DirtSwordInfo")

This discussion is preserved as it was. New answers, comments, and votes are closed.