Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 5 months ago
Edited 5 months ago

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.

0
I don't understand why this doesn't work, it's very simple. AJ_VEGAS 91 — 5mo

1 answer

Log in to vote
0
Answered by 5 months ago

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.

0
I understand it, thanks! AJ_VEGAS 91 — 4mo
Ad

Answer this question