So I have this GUI under StarterGui, and I want to have the ability to disable & enable it whenever I want to for the whole server (for all players) in-game, preferably by a command I would type in Dev Console, is that possible? If so, how can I do that?
Make a script receiving a signal from BindableEvent. The script should disable the GUI in StarterGUI and then it should access every’s player PlayerGui to disable the GUI (by using for loop). It means that you will be able to disable the GUI by just typing one command, which is firing the created BindableEvent. To enable back the GUI make it so the BindableEvent passes an argument, which is a boolean.
If it’s used to disable the UI for ALL clients, they’ll need to use a RemoteEvent
instead of a BindableEvent
.
I suggest to use remote events
Heres the sample code:
–server side
local remote
remote:FireAllClients()
–client side
local remote
local plrGui = game.Players.LocalPlayer.PlayerGui
remote.OnClientEvent:Connect(function())
local targetUI = plrGui.TargetGUI
targetUI.Enabled = false
end)