Im working on a flare gun in my game. When firing, it is supposed to place the flare onto a part in the flare gun then fire upwards. When standing still it works, but if moving the CFrame is set to slightly behind the player.
Try setting the network ownership to the player or the character. Also using a while loop and velocities don’t really mix well together, just use one velocity, unless you want a curved type of thing, which you are probably doing here.
Also you are not cleaning up any memory after you make a new thread, so each time you fire, the while loops will stack, causing a memory leak.
This is probably because the Instance is created on the server and the physics are controlled on the server. This means there is delay between the physics on the server and the copy of the physics sent back to the client (which you see in the video).
The most ideal workarounds for this are:
(Works for things that are only visual effects) Creating the instance client side, then sending RemoteEvents to have the other clients also create client sided instances (TL;DR: create a flare on the client, fire server, have the server fire to the other clients, have the other clients create a flare)
(Most ideal for synced physics) Using TheNexusAvenger calls a “Physically-Owned Projectile Buffer”. Basically, you have the server create copies of the projectile beforehand and give the client ownership (and store them by placing them far away and frozen in place with a BodyPosition, which you can remove on the client to control it. If you’re using streaming enabled make sure to put the projectiles in a Model with Persistence set to Always), then the client can use the projectiles when it needs them and send a remote to the server to make more or remove old ones (or just move them to the void (a very negative y position) on the client to delete them on the server also).