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

Why is my click detector working in studio, but not in game, even with FE off?

Asked by 5 years ago

My click detector, which is supposed to open a GUI, works in the studio but not in game, even with FE off. Here is the script:

script.Parent.MouseClick:Connect(function(plr)
    plr.PlayerGui.ASK.CODE.Visible=true
end)

--ASK is a ScreenGui and CODE is a frame
0
Same thing is happening to me, just checking but you're using a local script right? TairaAkiko 26 — 5y
0
Is it a LocalScript? Fewice 22 — 5y

2 answers

Log in to vote
2
Answered by
herrtt 387 Moderation Voter
5 years ago

You have to use a Server Script to make a clickdetector work, and second, you cant turn off Filtering Enabled, it is always set on. Even tho it is a button, but that wont acctualy turn off FE. Third, Server Scripts cant access the PlayerGui, so you got to use a Remote.

0
I still don't get it. I've made other places where it works perfectly fine. YieldingSweetblade 5 — 5y
0
ROBLOX's updates with FilteringEnabled have changed how some things may function, so doing this at past places could've worked well, but not if you do it again in the present. Lugical 425 — 5y
Ad
Log in to vote
2
Answered by
Lugical 425 Moderation Voter
5 years ago

You see, with FilteringEnabled always required to be on now, things will have to be scripted differently. What I'd suggest is using RemoteEvents to get the GUI showing after clicking this part. Here's my example: PS: Add a RemoteEvent in the ReplicatedStorage. SERVER SCRIPT

--Server Script (Fires the client)
script.Parent.MouseClick:Connect(function(plr)
   game:GetService("ReplicatedStorage").RemoteEvent:FireClient(plr)
end)

GUI SCRIPT

--GUI Script (Receives the event. This should be a local script)

game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function()
 script.Parent.CODE.Visible=true
end)
--The LocalScript's parent should be the ScreenGUI. You can place it on CODE too, but you'd have to make some changes.

Answer this question