Server/Client replicating issue

So I have an effect when the player kills an enemy that makes some particles and sound effects

I’d like these to be synced to the animation so I made them play on the client since If i fired a remote event it’d have some delay

Of course, the problem is, doing this on the client doesn’t let the other players see it

SO I THOUGHT: After doing it on the client I'll fire an event to replicate it on the server

THE ISSUE:

If i use FireAllClients() it will also re-replicate on the player who fired the event first, so the player will see it happen twice

help please :sob:

Fire it to every player except for the one who you already did the effect for.

How? does FireAllClients have a parameter for that?

Use a loop.

Code:

local Players = game:GetService("Players")
local RemoteEvent = whatever

for i, player in Players:GetPlayers() do
	if player ~= alreadyFiredPlayer then
		RemoteEvent:FireClient(player)
	end
end

Oh… why didn’t I think of that?

Also Is it not necessary to use pairs() in a for loop?

1 Like

Yeah, I’m using generalized iteration. It’s not necessary to use pairs or ipairs.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.