Hey gamers, I’m trying to create a simple script that opens and closes a gui. I have no clue why this isn’t working. I’ve tried various different solutions I got from the internet, including the devforum, but nothing works.
Explorer:
Script
local click = script.Parent.MouseButton1Click
local menu = game.StarterGui.Menu.Frame
local function toggle()
end
click:Connect(function()
if menu.Visible == true then
menu.Visible = false
else
menu.Visible = true
end
end)
local click = script.Parent
local client = game:GetService("Players").LocalPlayer
local menu = client.PlayerGUI.Menu.Frame
click.Activated:Connect(function()
menu.Visible = not menu.Visible
end)
You were changing the frame in StarterGUI and not PlayerGUI.
Also, interact with UI objects on the client (LocalScript).