Many PVP and fighting games use client-sided hitboxes for the combat to feel more responsive for the player. However, for PVP specifically, the server needs to check so that exploiters don’t take advantage of the client-side.
I have made a tool system that utilizes these client-sided hitboxes, however, the tool isn’t syncing the server and client scripts for activation correctly.
Sometimes when using the tool, the hitbox/tool ability won’t load in for the client but the server will still run the tool cooldown.
The activation works for the most part, just at random moments it won’t work and that can be really bad, especially for a PVP game. When it works, it works perfectly fine and there are no issues through there, I only have this one issue.
Video above is showing the issue happening, sometimes the ability won’t load with the client but the server will activate the cooldown upon use.
The system that I have set up uses:
- Local script in the Player to send event signals.
- RemoteEvent in ReplicatedStorage to link client to tool.
- BindableEvent in the tool to load hitboxes in the client.
- Server and a local script to activate the tool.
(the client script loads in the hitbox, server does the damage after a hitbox is confirmed accurate)
Changing the locations of the events still bring up the same issue, the system I have right now is the latest change I have made to it.
I have tried altering the code to try and make the cooldown load after the client (i.e, connecting the hitbox before), but I am still held with the same issue.
The local script from the player sends signals for every input and allows for the player to hold down the main activate key (i.e, LMB from mouse, a button on mobile, and GamepadX for controller).
If there are any other things needed to fully solve this issue, let me know!