For some reason, I can't find out a way to make a working line of code to just make the Visible property of a TextButton Gui to be false, from a non-Local script in workspace. I tried doing something like this:
local sgui = game:GetService("StarterGui") sgui.ScreenGui.Button1.Visible = false
But that didn't work. Then, I thought I had to call the PlayerGui instead. Since this will activate when the player touches a brick, I tried something like:
local you = game.Players:FindFirstChild(hit.Parent.Name) local btn = you.PlayerGui.ScreenGui.MSonicFormsBtn if not btn.Visible == true then btn.Visible = true end
But that also didn't work. I feel like, since it's just changing a property of something that's simply located in StarterGui, it's something easy that I'm forgetting. But I can't figure it out for the life of me.
GUI instance's are client only interface objects, and as such they should only be mutated by client (local) scripts, even for the odd-ball cases that automatically replicate. You should use a remote event to tell the client to update it's gui if the change is determined in a server script.
StarterGui is used to house template screengui instances that are cloned and placed into each client's PlayerGui at either load time, or for every respawn, determined by a 'ResetOnSpawn' property.
Because a clone of the ScreenGui is given to the client's PlayerGui, making changes to the ScreenGui will not display for any players. You need to mutate the clone of the ScreenGui that exists in Player.PlayerGui if you want changes to display without requiring a respawn.