Trouble with GUI appearing when I don't want it to

Hello everyone, I’ve been experimenting with GUI for the first time with some scripting. I tried doing the simple command of making it invisible until something commands it, but I’m stuck on my first command. Can anyone tell me why it’s not visible? Thanks!

(P.S. I don’t just want a script, but an explanation to learn)!

-- game.StarterGui.TextLabel.Visible = false

Screen Shot 2021-06-25 at 11.41.35 AM

1 Like

If the script is located somewhere in the ScreenGui then you can just use script.Parent.
If the script is located in a different place like the workspace or something you would have to use PlayerGui.

Sorry if this explanation is bad.

1 Like

you’re making the gui in startergui invisible not the one on the player, to access the guis of the player you simply do

---Assuming we use localscript
local Player = game.Players.LocalPlayer

Player.PlayerGui.ScreenGui.TextLabel.Visible = false

if you want to use server scripts then you’d have to use remotes to get the player or just parent the script to the UI you wanna disable and just script.Parent.Visible = false that’s equivalent to Player.PlayerGui.ScreenGui.TextLabel.Visible = false as long as the server script is parented to the UI you wanna disable, it should work.

1 Like

StarterGUI just clones everything once the player joins in the game inside Player.PlayerGui
so if u want to make a UI invisible u should have a local script(so it only happens for the client and not the entire server) inside the UI and then u can do script.Parent.Visible = false

1 Like

Your problem here is that you are defining TextLabel as being under StarterGui. This is not correct. TextLabel is under the ScreenGui which is under StarterGui. You could also use script.Parent to make life easier and to make the process a lot faster. Another tip is that if you have the gui sharing for a bunch of members and want it to change for everyone, use the script. If you only want it to change for you, use a local script. Assuming you want it to make it invisible upon join, you can go into studio and uncheck visible to make it invisible forever. If you do want it to go invisible when you join, here is what you do:

script.Parent.Visible = false

Hope this helped!