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

My Shop won't open when I click on it? Please help, the game is FE.

Asked by
Fako16 13
5 years ago

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!

0
You don’t use StarterGui. You use PlayerGui. User#19524 175 — 5y
0
What does FE mean? fa_QURobloxXD 29 — 5y
0
FE means filter enabled Littlenatnat8508 4 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You should be using PlayerGui to get the frame. Not StarterGui.

You also don’t need any 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)

On a side note, you should switch to Connect as ROBLOX may remove connect soon.

0
Thanks for your response, but it still doesn't work? Do you want me to send you the properties of the menu? The script seems good, but it doesn't work for some reason. Fako16 13 — 5y
0
line 4 should be local plrGui = plr:WaitForChild("PlayerGui") SirDerpyHerp 262 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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

Answer this question