Problems with handling the networking of pellets

I am trying to make a bullethell game, similar to Enter the Gungeon.
While I have managed to do the Player’s bullets fairly well, this system is not working out for the enemy’s bullets.

Currently, both the server and the players’ clients get copies of the same data and process the hitboxes while only the client showcases the bullet. As you can see from this video, there are a multitude of times, due to the differences in replicating the character, there are instances where the client hits when the server says otherwise, and vice-versa.

Notice that the explosion effect happens when it hits on the client, while the server takes damage and prints on the output.

I am looking for alternatives on handling this issue. All help is appreciated.

If you have a lot of things passing through your server through events or functions you could try using a module script to handle the damage and explosions. Because if your server or clients have things like

--Do attack animation

Wait(2)

--Damage player

It will cause your function passing to be delayed over time which a module script can fix causing no delay and can even be called multiple times at once regardless of wait timers or etc, but with the amount of information you gave I can’t personally figure out your problem.

Well, it is kinda hard to explain. I have modules for both the hitbox detection and the trajectories. When a client does an action, it instantly generates a bullet’s visual on the client and send a remote with the data. After sanity checks, the server will distribute these effects to the other clients and check for hits, in which case it deals damage. The clients are also constantly reading for hitboxes to handle visual effects upon hitting.

This is not working so well for the NPC’s attacks though… As you can see in the video, there are instances in which the hitboxes kind of “desync”? due to the player’s character updating later on the server. As such I am looking for alternative ways of handling this while giving correct and responsive feedback to the players.