Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

Same thing is happening to me, just checking but you're using a local script right?

0

Is it a LocalScript?

2 answers

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.

2 comments

0

I still don't get it. I've made other places where it works perfectly fine.

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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.