I'm trying to make a gui close button, no intentions to re-open it btw. I have the code and I even added a print to be sure where my mistake was and whenever I click the button nothing happens, yet I get no errors
game.StarterGui.ScreenGui.Frame.TextButton.MouseButton1Click:Connect(function() print("hi") game.StarterGui.ScreenGui.Frame.Visible = false end)
The reason why it isn't working is because you're getting the ScreenGui from the StarterGui instead of the player's PlayerGui. Every player has a PlayerGui when they join a game and everything inside of StarterGui will replicate into their PlayerGui. You will need to get the player's PlayerGui and get the GUI's from in there and make changes to those for them to be able to see it.
The correct way to write your function would be:
script.Parent.MouseButton1Down:Connect(Function() game.StarterGui.ScreenGui.Frame.Visible = false end)
*Make sure to make this a local script and place it into the close button (Textbutton)