How would I go about making it so the server replicates a certain action to all clients except for one?

I’m currently thinking of how I’m going to set up a hit-validation system for a project of mine, but I may have ran into a potential issue. Essentially, in order to maintain responsiveness, when a client shoots a projectile, all physics/interactions of that projectile are handled client side. Of course, this is a huge security concern, which is why my server-side validation model includes duplicating the projectile and analyzing its behavior’s and interactions on the server. If the behavior of the client’s projectile is different than that of the servers, I’d be able to “cancel” the result of the client’s projectile.

Now, this means the client will see two projectiles; the projectile managed on the client, and the projectile managed on the server (that will be seen by the client shortly after due to latency).

How can I make it such that the client does NOT see the server-sided projectile?

if you are just using remoteevents just fire the event to all players except the client who fired the weapon

for k, player: Player in PlayersService:GetPlayers() do
    if player ~= clientWhoShot then
        yourEvent:FireClient(player, ...)
    end
end
2 Likes

It would not be based on remote events. All server-side objects are replicated to each client by default, so my concern is how I’d make it not replicate to one individual client. I suppose I could just make the particle invisible for the client.

You’d just have to use remotevents and either:

Make a localscript pick up on the change and change it, fire it to everyone except the player (How would I go about making it so the server replicates a certain action to all clients except for one? - #2 by bongusbingis)

Or make it run for everyone and just change it back from the client.

1 Like

You could have some sort of attribute that says the player the bullet came from on the server object. Then have a client script that would make all bullets from the server that the local player shot invisible.

Yeah I think this is probably the most efficient way to go about it. Thanks

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