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

Why won't my GUI open when button is pressed?

local plr = game.Players.LocalPlayer

local function close()
	game.Players[plr].PlayerGui.level.Frame.Visible = true
	game.Players[plr].PlayerGui.Shop.Shop.Visible = false
end

script.Parent.MouseButton1Down:connect(close)

When I pressed the button...the "script.Parent.Parent" becomes invisible, but the "game.StarterGui.level.Frame" doesnt become visible, but I want it to be visible? Please help? Thanks

I get this error "Players.Player1.PlayerGui.Shop.Shop.Close.Script:4: bad argument #2 to '?' (string expected, got Object)"

1 comment

0

you need to acces the player gui not the starter gui, game.players.[playername].playergui ect

1 answer

✓ Accepted answer
--Script needs to be a local script

local plr = game.Players.LocalPlayer

local function close()

   plr.PlayerGui.level.Frame.Visible = true

   plr.PlayerGui.Shop.Shop.Visible = false

end

script.Parent.MouseButton1Down:connect(close)

1 comment

0

can you tell me when i need to use localscripts and when i need to use regular scripts please?

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