My GUI doesn't work in-game when I click on it, FE is enabled btw. Here's the script:
local Button1 = script.Parent.Parent local Button2 = script.Parent.Parent Frame = game.StarterGui.ScreenGui.ShopMenu function onClick() if Frame.Visible == false then Frame.Visible = true elseif Frame.Visible == true then Frame.Visible = false end end Button1.MouseButton1Click:connect(onClick) print("Worked")
If you need anything else, please comment and i'll respond, thanks!
PlayerGui
to get the frame. Not StarterGui
.if
statements to check the Visible
property.-- LocalScript local plr = game:GetService("Players").LocalPlayer local plrGui = plr:WaitForChild"PlayerGui" local frame = plrGui.ScreenGui.ShopMenu script.Parent.Parent.MouseButton1Click:Connect(function() frame.Visible = not frame.Visible end)
Connect
as ROBLOX may remove connect
soon.Try this script:
local Frame = game.StarterGui.ScreenGui.ShopMenu local enabled = false function onClick() if Enabled == false then Enabled = true Frame.Visible = true else Frame.Visible = false Enabled = falsw end end Button1.MouseButton1Click:connect(onClick) print("Worked")
You have to put this in local script