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 4
10 days 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. incapaz 3232 — 10d
0
What does FE mean? fa_QURobloxXD 32 — 10d
0
FE means filter enabled Littlenatnat8508 4 — 10d

2 answers

Log in to vote
0
Answered by
incapaz 3232 Moderation Voter
10 days ago
Edited 10 days 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 4 — 10d
0
line 4 should be local plrGui = plr:WaitForChild("PlayerGui") SirDerpyHerp 59 — 10d
Ad
Log in to vote
0
Answered by 10 days 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