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

How to run a remote event at the same time for everyone?

So I'm trying to fire a remote event for all clients at the same time ( so every client runs it at the same time locally ). How would you do this regardless of lag, I understand you need to add a timeout in case someone is lagging too much.

1 answer

Hello, tantec! It is easy. Just use the RemoteEvent:FireAllClients() function. Unlike FireClients(), it doesn't require a player instance. The FireAllClients() function should fire a RemoteEvent at the same time for everyone. Here's an example:

Server:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChildOfClass("Humanoid") then
		game:GetService("ReplicatedStorage").TouchGuiEvent:FireAllClient()
	end
end)

Client:

game:GetService("ReplicatedStorage").TouchGuiEvent.OnClientEvent:Connect(function()
	script.Parent.TextLabel.Text = "A humanoid has touched a part!"
end)

If this helped you please accept this answer.

1 comment

0

No, I mean. I know how to do this, it's just that, how would you make it so everybody runs it at the same time. Like for example, there's going to be laggy people and firing to the client will take much longer than for someone with lower ping. Is there anyway to get around this?

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