When I shoot a bullet, it takes too long to go from server back to client to create the bullet, so by the time bullet has come out, my characters already changed where it’s looking
Hard to record when I click, but the bullet is being created about 0.5 second after I have already clicked.
How can I get this to be instant, while still creating the bullets on all the other clients?
Try visually create the bullets on client while the server manages its hit detections. Additionally, fire to all clients to replicate the fired bullet.
Adding on to this, you’ll inevitably experience the person who fired the cannon seeing the effect twice. To prevent this simply use an in pairs loop and iterate between all the players in-game, then proceed to fire the remote to all the clients except the original player.
for _, v in pairs(Players:GetPlayers()) do
if v ~= player then
BulletFired:FireClient(v, weapon, start, target, speed, drop, TeamColor)
end
end
And then on the client, when I fire the bullet, it creates it for me straight away, then fires to the server, server does checks, then fires to all the clients (but my own client)