Inconsistent Client/Server Explosions

I have a script creating explosions. On player key input, a raycast is fired on the client and an explosion is created at the end of the raycast on the server.

This works fine, HOWEVER, explosions will occasionally have different results on the client who fires the raycast and the rest of the server.

For example, I could destroy a vehicle and that player would be totally out of commission. But when this glitch happens, the person in said vehicle, and everyone else in the server, will see it as if it never happened. Only I would see their vehicle destroyed

One part of the vehicle would still move around, and they can still shoot back at me since they can still operate normally. All I see on my end is a flying brick that shoots and kills me.
Because the raycasts are on the client, the only target I have to re-destroy them would be whatever that part is left of them on my end, often a small target.

I think this glitch only happens with bad internet. Since Roblox chooses to base their servers that I connect to on the moon, I get 1k+ ping spikes every 10 seconds only on my home internet.
It works fine in Studio and playing by myself, and only appears when playing with someone else. The glitch frequently happens with me and I haven’t had it reported with other people.

1 Like

Did you transmit the data to all of the clients or only to the single client who created the raycast?

raycast ONLY ON SERVER!! client can modify it, even not cheaters but ping ect. you should consider synchronization methoods too, there’s a youtube tutorial

Raycast info from the client goes to the server which handles most of the functions

I have racyasting on clients to make it calculate smoother with poorer connections