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 6
4 months 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 6717 — 4mo
0
What does FE mean? fa_QURobloxXD 29 — 4mo
0
FE means filter enabled Littlenatnat8508 4 — 4mo

2 answers

Log in to vote
0
Answered by
incapaz 6717 Moderation Voter
4 months ago
Edited 4 months 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 6 — 4mo
0
line 4 should be local plrGui = plr:WaitForChild("PlayerGui") SirDerpyHerp 166 — 4mo
Ad
Log in to vote
0
Answered by 4 months 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