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

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

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

✓ Accepted answer

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)

2 comments

0

Or you could just disable the gui on the server using Player.PlayerGui

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.

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