Which method is better for a shooting game?

So I have started making a Roblox shooting game. Instead of doing LocalScript reducing the targets humanoid health everytime they hit the enemy, I’ve decided to make a mechanism to avoid players killing eachother at once.

So this is how It works:

When a player shoots someone, the player’s localscript sends a petition (with a RemoteEvent) to deal damage to their target. However, there may be situations where the script gets 2 petition at once. For example, it may get 2 petitions about 2 players that have dealt mortal damage to eachother (can happen because of latency).

In this situation, I should program the priority of each petition, but I’m stuck between 2 options:

  • By time: With the tick() function, I could check which player have fired first. If one of the players sent the petition with less tick() time, then the other petition would be discarded, since in that moment, the other player would be dead. The only issue is that this can be abused by players that have tons of lag, which can kill players that seem to be frozen.
  • The petition that reached faster: The first petition will be processed first, but It may be quite unfair for people with slow computers/internet.

So which option do you consider better? (Sorry for my bad english)

Just as a rule of thumb, you probably shouldn’t trust what the client sends you. An exploiter could gain an edge by always sending 0 as their tick() output. This remains true for your attack logic. If it depends on the localscript determining if they hit an enemy, then you’ve already lost. It’s like walking into a store and telling the cashier whether or not you can pay for something rather than using a bank card or cash.

Use option 2 and revise your attack logic to make it more exploiter proof.

1 Like

Thanks alot for the tip. I better test It with a couple of players before I keep up the project

1 Like