When click a button on UI, it shows a different UI to everyone in server, then disappears 3 secs later

Says in the title.

I have a GUI, when I click a button I want it to show a different GUI to EVERYONE in the server.

Use a remote event to make the gui enabled to everyone. Then have a counter for how many seconds the gui is enabled then disable the gui or make it not visible.

Local script

Button.MouseButton1Down:Connect(function()
RemoteEvent:FireServer()
end)

Script

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
local gui = player.PlayerGui:WaitForChild('GUI') -- put the gui in startergui and disable it. Or an alternative is to have a local script in StarterCharacterScripts and put a local script inside, put the gui in replicated storage, and clone it into the player gui.
gui.Enabled = true
if gui.Enabled == true then
wait(3)
gui.Enabled = false
end
end)

In replicated storage do I need something?

Sorry forgot to define variables. For the local script

local Button = script.Parent
local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- to answer the question you only need the remote event, but you can insert the gui as I stated earlier

Script Variables

local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- side note, add WaitForChild() just in case
1 Like