Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago
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)"

0
you need to acces the player gui not the starter gui, game.players.[playername].playergui ect User#5423 17 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
--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)

0
can you tell me when i need to use localscripts and when i need to use regular scripts please? thehybrid576 294 — 8y
Ad

Answer this question