UI not showing up

  1. I wanna make a Shop ui appear when a button is clicked.

  2. The issue is that whenever I try to enabled / make a ui visible using a local script/ script it doesn’t work at all

  3. I have tried enabling the ScreenGUI instead of setting visible on the frame, tho it did not work anything I tried didnt work, and this is not the first time

local shopBut = script.Parent.Shop
local CustBut = script.Parent.Customise
local Build = script.Parent.Buildmode
local ShopUI = game.StarterGui.Shop.ShopMain

shopBut.MouseButton1Click:Connect(function()
	ShopUI.Parent.Enabled = not ShopUI.Parent.Enabled
	print("1")
end)

Although it prints the “1” it does not work for some reason there are no output errors or anything, this is not the first time i’ve encountered this.

You have to use PlayerGui instead of StarterGui.

local plr = game.Players.LocalPlayer
local gui = plr.PlayerGui

Try this:

local shopui = script.Parent
local shopbutton = script.Parent.Shop

shopbutton.MouseButton1Click:Connect(function()
	shopui.Parent.Visible= not ShopUI.Parent.Visible
	print("1")
end)

Make it a local script too.

2 Likes

Players.N_ckD.PlayerGui.Intro.Main.Script:2: attempt to index nil with ‘PlayerGui’ - Server - Script:2

Yeah, Like @vf9r said. You have to use a local script. Not a server script.

1 Like