Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a Remote Event make a gui invisible?

Asked by 1 year ago

I've been trying to make a Remote Event trigger when you say "Event Starting", which makes a GUI turn invisible, however, I'm not 100% sure how to do it. Any helpers?

1 answer

Log in to vote
2
Answered by
pwx 1581 Moderation Voter
1 year ago

You can use a RemoteEvent to fire all clients, this is a great way to update everyone's Gui all at once!

Server

local replicatedStorage = game:GetService('ReplicatedStorage')
local removeGuiEvent = replicatedStorage:WaitForChild('removeGui')

removeGuiEvent:FireAllClients()

Client

local replicatedStorage = game:GetService('ReplicatedStorage')
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local removeGuiEvent = replicatedStorage:WaitForChild('removeGui')

removeGuiEvent.OnClientEvent:Connect(function()
    local playerGui = Player.PlayerGui
    local Gui = playerGui:FindFirstChild('GuiToRemove') -- obviously change this to your UI name!
    if Gui then
        Gui.Enabled = false
    end
end)
0
Or you could just disable the gui on the server using Player.PlayerGui T3_MasterGamer 2189 — 1y
0
As much as you can do that, some UIs are only replicated on the client due to it being made on the client. Hence why it's somewhat bad practice to access it from the server. But yes, that works too. pwx 1581 — 1y
Ad

Answer this question