Does handling hitboxes on the server cause more lag as opposed to doing it locally?

I handle my hitboxes on a server script that is run once the appropriate remote is fired. It creates a region3 around my character that checks if I have hit anyone within the region. I don’t know if this is very effective however in real-time where there are a lot of players present, or if things will get really laggy. Some feedback on this appreciated.

Handling hitboxes on the client is defintley a no go but maybe doing a hybrid is okay? But I’d still advise doing it on the server. Remember to never trust the client. If you let the client handle the hitboxes, the client can just change the hitbox to automatically be in a person’s position causing infinite reach and so on.

Yeah I was worried about exploiters being able to expand hitboxes. Can you give an example of how a hybrid would work?

If you can make a proper server validation system, you can have it so that the client attacks and tells the server that it’s attacking, the server makes a record of that, and then the client goes on to check for a hitbox collision, and fires a remote, the server then makes sure it had a record of the attack, and does its own check to make sure that it made sense, and then handles the damage.

  1. Player does attack and fires remote
  2. Server makes sure that attack was allowed and stores a bool (cooldowns, etc)
  3. Player handles hitbox and fires remote when there is a collision
  4. Server checks if the attack was allowed (if statement from step 2’s bool)
  5. If the attack was allowed, then it validates the collision’s legitimacy, perhaps using ray:ClosestPoint() or something like that.
  6. If the collision makes sense to the server, the server deals the damage.

The reason to this is because if you handle the hitbox collisions just on the server, there will be a latency delay. If, for example, the player is moving forward, he will see himself more forward but on the server his location is slightly behind, which can lead to his attacks missing when they should’ve hit, because his location isn’t updated on the server yet. I’m not great at explaining, sorry.

This is similar to how games like Overwatch handle their collisions.

Just make sure the validation system works so that it can’t be exploited and you’re set.

I think this is what @3rdhoan123 meant by a hybrid.

5 Likes

Thank you for the insight I’ll look into doing something like that