How can I make a GUI show up for everyone at the same time while tweening

I am making an admin script and I have a command which shows a message for everyone on the screen, the problem is though, I firstly tween the GUI down from the top of the screen, wait a certain amount of time depending on the length of the message, and then tween it back up. This means if I were to use a loop to put the GUI in everyone’s PlayerGui folder, the players would see the message at different times. Is there a way round this?

RemoteEvent:FireAllClients() is what you are looking for

1 Like

How would I go about using FireAllClients() in this scenario?

1 Like

Yes, the way of achieving this effectively is through the utilization of a RemoteEvent.

Here’s an example, I will break it down for you:

-- Server

local SendEvent = game.ReplicatedStorage:WaitForChild('RemoteEvent') -- Add an event into ReplicatedStorage, name it what you would like

local Message = "" -- This is an example; this will represent the argument sent through the event

SendEvent:FireAllClients(Message) -- This is what will fire to all clients, which will be received by each player's GUI. "Message" is the string which will hold what the actual message is
-- Client

local SendEvent = game.ReplicatedStorage:WaitForChild('RemoteEvent')
local Text = script.Parent.TextLabel

SendEvent.OnClientEvent:Connect(function(message) -- The function which will receive the event when it's fired
    Text.Text = message -- Will make the TextLabel text the message you passed from the server to the client
    Text:TweenPosition(UDim2.new(0,0,0,0)) -- Just a placeholder, position it where you want it to be visible
    wait(5) -- The amount of time it will be shown to all players
    Text:TweenPosition(UDim2.new(0,0,0,0)) -- Position it where you want it to be hidden
end)

You can learn more about TweenPosition and its params here:

1 Like

Thank you! I understand what the other person meant now by using FireAllClients()

Have a good day!

2 Likes