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.
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.