So I made a door and if you touch it without filtering enabled then a GUI will pop up. But with filtering enabled it doesn't work anymore
This is the door script:
function onTouched(hit) local torso = hit.Parent:findFirstChild("Torso") if torso==nil then X = game.Players:playerFromCharacter(hit.Parent) X.PlayerGui.ScreenGui.QuestionS.Visible = true end end
script.Parent.Touched:connect(onTouched)
GUI script in StarterGui:
script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Visible = false end)
How everything should look for you: http://prntscr.com/c2rcfu
Put a serverscript into the brick, put a GiveGuiOnTouch RemoteEvent in the ReplicatedStorage Put a LocalScript into StarterGui and make GUIS exactly like this on the screenshot or change everything in the script how u like.
ServerScript in a Brick
This script has to be in the Part that when u touch, the script fires your client from Server > to LocalScript.
local brick = script.Parent --where the brick is local repStorage = game:GetService("ReplicatedStorage") --Gets replicated storage local Event = repStorage.GiveGuiOnTouch --where the event is brick.Touched:connect(function(p) -- when our brick is touched local h = p.Parent:FindFirstChild("Humanoid") -- find humanoid if h ~= nil then --if the humanoid exists local player = game.Players:GetPlayerFromCharacter(p.Parent) -- get the player from character Event:FireClient(player) -- fire the client end end)
LocalScript in StarterGui
This script waits when the Event:FireClient(player) activates it from the Brick touching!
local repStorage = game:GetService("ReplicatedStorage") -- get replicatedstorage local Event = repStorage.GiveGuiOnTouch -- where the event is local player = game.Players.LocalPlayer -- player variable Event.OnClientEvent:connect(function() --listens the event when FireClient is fired it will activate player.PlayerGui.ScreenGui.Frame.Visible = true -- makes your GUI visible. end)
LocalScrpt in a GUI button
This is just a button that disables visibility on click
script.Parent.MouseButton1Click:connect(function() --when the gui's button clicked script.Parent.Parent.Visible = false -- make it invisible! end)