Shotgun fire causing lag

Hi, I’ve got a Shotgun, so I need to fire multiple pellets at the same moment. I used this system by Rama, but if I use one pellet, it’s working, while if I use more than one pellet, it’s causing lag.

This is the system:

What do you mean by “lag”? Do you get bad FPS?

No, i ser the player teleporting while shooting, but it’s not bad for. Maybe there are too many packets. In addiction, if I replicate the impact effects to all clients, I see only two impact effects, even if the server shots are more than 2.

You can also try to simulate the effects on the client while doing the actual impact on the server.

Now I did a system that uses a single RPC call, because it generates all the hit results on the client, and then send them to the server, but it’s still lagging when firing. What can I do?

Mhhh how many shots are you transmitting? You should only transmit the ‘fire’ not every one and calculate them on the server and simulate them on the client (you could share the random seed to produce a predictable spread). Other clients can just simulate in on their own, they do not have to be that accurate.

Solved creating the hits on the server. Now I’m sending only the aim direction to the server.