So I made a script where when a brick is touched a Gui opens:
local Part = script.Parent Part.Touched:connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local Player = game.Players:GetPlayerFromCharacter(HIT.Parent) Player.PlayerGui.NPC.ChatGuiOne.Frame.Visible = true end end)
^ This isn't the problem, it works fine
This is kinda what my StarterGui looks like in the Explorer:
StarterGui NPC --Folder ChatGuiOne --ScreenGui Frame CloseButton --TextButton LocalScript
This is what that LocalScript looks like:
script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Visible = false end)
This didn't work so I thought maybe the problem was something to do with everything in StarterGui being cloned into PlayerGui, so I tried this:
script.Parent.MouseButton1Click:connect(function() game.Players.LocalPlayer.PlayerGui.NPC.ChatGuiOne.Frame.Visible = false end)
Neither of them work. I hope I gave enough detail for someone to help me out. :-)
If you already made the open button, and it's scripted that means the frame should now be visible, so with the close button ...
local on = true function off() if on == true then on = false game.Players.LocalPlayer.PlayerGui.NPC.ChatGuiOne.Frame.Visibiel = false