Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to toggle the visibility of a GUI on every player's screen?

I was having issues when I called this. It is supposed to change the visibility of all the GUI's in the game that are active.

	game.StarterGui.Shutdown.Enabled = true

It's very simple, but I don't get any output when it doesn't work, can somebody please help? Also, do I need a remote event, I tried to do it with a remote event, but it didn't work. I'd also like to note the GUI works completely fine and I had another GUI that would appear in an unowned VIP server, and it worked PERFECTLY fine on all players screens, I'm assuming this is because the server is just starting, but yeah.

1 comment

0

I don't understand why this doesn't work, it's very simple.

1 answer

✓ Accepted answer

Anything in StarterGui will be cloned into the player's PlayerGui sometime shortly after the player joins. What this means is that the server is changing a property the ScreenGui in StarterGui, but not the clone which is currently in use, located in the PlayerGui. You can use remote events to change client stuff from the server, but what I like better is just using implicit replication. This can be accomplished by placing the ScreenGui (Shutdown) in ReplicatedStorage, or one of its descendants, and then manually using a LocalScript to set its parent to the player's PlayerGui, which is a child of the Player instance.

Something like

--in a LocalScript
game.ReplicatedStorage.Guis.Shutdown.Parent = game.Players.LocalPlayer.PlayerGui

should suffice, assuming that Shutdown is inside of a folder named "Guis" which is inside of a ReplicatedStorage.

1 comment

0

I understand it, thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.