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

Is it possible to fire 2 clients the same time?

Hi, i want to fire a clientevent on 2 players the same time. When i just make

remote:FireClient(player1)

remote:FireClient(player2)

it first fires the event for player1 which takes some seconds then it fires player2. Is there a way to fire them at the same time?

3 answers

✓ Accepted answer

If for some reason it is waiting before firing the other client you could use a coroutine structure like this:

coroutine.resume(coroutine.create(function()	
	remote:FireClient(player1)
end))
remote:FireClient(player2)

This will run the code in it's own separate coroutine aside from the code beneath it.

3 comments

0

They don't wait, also you should be using the built-in spawn function instead of the coroutine library.

0

thanks that works

0

@yankana I know that, I'm just saying "If for some reason it is waiting" here is a possible solution.

--Use "Spawn(function()"
-- Example
spawn(function()
plr:FireClient()
end)
-- rest is fine after you do it for first fire

FireClient should not take any seconds at all. It isn't a yield function which means it doesn't wait for anything. Doing what you posted should fire to both clients almost simultaneously, with a negligible difference which shouldn't matter due to other much bigger factors such as traffic delays.

2 comments

0

I have a tween in the client event that takes some seconds. Thats what i meant.

0

Still, the OnClientEvent should be fired for both players at the same time, unless you consider traffic delays which you can't really do anything about.

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