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

Problems making a shop close in a Filtering Enabled game?

Asked by 7 years ago
Edited 7 years ago

I have been testing with a shop and successfully created a normal one, in a non-FE place. However, I tried making the shop in Filtering Enabled, and I got as far as the close button before I got stuck. The closing script works fine in play solo, but not in a local server or in an actual game.

This is how I made it,

game > StarterGui > Shop(ScreenGUI) > Frame1(Frame) > Close(TextButton) > LocalScript

The LocalScript's Code

1function onClicked()
2    script.Parent.Parent.Parent:Destroy()
3end
4script.Parent.MouseButton1Click:connect(onClicked)

I researched a bit about Filtering Enabled and Remote Events/Functions, yet I still was very confused and making messy scripts so I just went with this simple script.

Also if you want to for any reason, you can see the shop here.

1 answer

Log in to vote
1
Answered by
iRexBot 147
7 years ago
Edited 7 years ago

You need to get into the player's PlayerGui instead of getting into it raw. Also use WaitForChild() and GetService() to stop those evil infinite yields

Local script:

01local Storage=game:GetService('ReplicatedStorage')
02local players = game:GetService('Players')
03local player = players.LocalPlayer
04local gui = player:WaitForChild('PlayerGui')
05local Shop = gui:WaitForChild('ScreenGui')
06local Frame = Shop:WaitForChild('Frame')
07function onClick()
08    if Frame.Visible==true then
09        Shop.OpenShop.Text = "Open Shop"
10        Frame.Visible=false
11    else
12        Shop.OpenShop.Text = "Close Shop"
13        Frame.Visible=true
14    end
15end
16 
17script.Parent.MouseButton1Click:Connect(onClick)

Please comment if this script doesn't work. i will try my best to solve the script ;)

0
Thank you so much. You don't understand how much I appreciate your help! It works by the way. I don't know why I hadn't tried what you posted, but either way thanks! You don't understand how much I have to thank you! I have posted on so many forums and people have given me answers that never worked. Thank you so much!!!!!! Draebrewop 114 — 7y
0
Remember FE likes it when you get into the player's gui ;) iRexBot 147 — 7y
Ad

Answer this question