This script is supposed to make the "jay" GUI disappear after the player steps on a brick.
Your assistance is appreciated greatly!
function onTouched(hit) local guy = game.Players:GetPlayerFromCharacter(hit.Parent) local ha = guy.PlayerGUI:findFirstChild("jay") ha:Remove() end script.Parent.Touched:connect(onTouched)
I think you spelled "PlayerGui" incorrectly
Scripts can't see things in PlayerGui
the server didn't put there if FE is enabled.
I recommend using a Local Script running on the client detecting this. You can then check if they're the one who touched the part. Here's an example:
--// Local Script in ReplicatedFirst or something local part = workspace:WaitForChild("Part Name") local localPlayer = game.Players.LocalPlayer part.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if((plr)and(plr==localPlayer))then local gui = plr.PlayerGui.ScreenGui.GuiName gui:Destroy() end end)
I used anonymous functions and, like I said, a Local Script.
function onTouched(hit) local guy = game.Players:GetPlayerFromCharacter(hit.Parent) local ha = guy.PlayerGUI:FindFirstChild("jay") ha:Destroy() end script.Parent.Touched:connect(onTouched)
Instead of using :Remove()
Try to use Destroy.
If you have any questions fee free to ask.