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)
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)
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.
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)
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.
1 comment
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.