Changing Parts CFrame support

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.


Ive already tried setting the flare’s network ownership to Nil and the character and still the same issue.

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.

I am disconnecting the loop it was just not in the screenshot :smile:

I attempted setting the Flares NetworkOwnership to the Player, Character and RootPart with no change. :slightly_frowning_face:

Does it curve or does it go straight up

its supposed to go just straight up. Ive tried removing the velocity from the loop and just moving it to the flare gun and it still lags behind.

Just update its cframe every frame and I’m sure it should be smoother

If i update the cframe every frame, it wont go up and it also wont be able to fall down like Flares do.

Anchor it, update its cframe, and when it reaches a certain height unanchor it and disconnect the event.

Also, you could use linear velocity

1 Like

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).
1 Like

Thank you, i will look into this

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.