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

function onClicked()
    script.Parent.Parent.Parent:Destroy()
end
script.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:


local Storage=game:GetService('ReplicatedStorage') local players = game:GetService('Players') local player = players.LocalPlayer local gui = player:WaitForChild('PlayerGui') local Shop = gui:WaitForChild('ScreenGui') local Frame = Shop:WaitForChild('Frame') function onClick() if Frame.Visible==true then Shop.OpenShop.Text = "Open Shop" Frame.Visible=false else Shop.OpenShop.Text = "Close Shop" Frame.Visible=true end end script.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