How can I make the tracer bullet visible to all players?

I want to make tracer bullets visible to all players without delay using Body Velocity. But I don’t understand how I can do it.
By the name “Tracer bullet” I mean a bullet flying into the distance, that is, not just a ray.
I have already tried searching on the developer forum, in the documentation, as well as on other Internet resources. And are there any other optimized ways to make a tracer bullet at all?

You could use tweens, but those don’t behave the same way a bullet with LinearVelocity (roblox.com) would. Creating the tracers on the client may help with delays, as you don’t need to wait for replication etc.

1 Like

Yes, you’re right, but I can’t make tracer bullets visible to all clients.

The way I do it is represent a projectile as a table that contains data such as originCFrame, shotTime (timestamp of when the projectile starts), and whatever other details you need.

Simulate the projectiles on each client using this data table. To get the position synced across clients, I use Workspace:GetServerTimeNow() both when setting the shotTime timestamp in a new projectile and when using it to determine its current time-in-flight.

That is, Workspace:GetServerTimeNow() - projectile.shotTime will give you a server-synced delta time that you plug into a projectile motion physics equation to give you its current position that is the same across all clients, regardless of network speed differences across clients.

To replicate a projectile, you can use a regular RemoteEvent to send it to the server and have the server fire the remote down to all the other clients (you should do some server sanity checks on originCFrame, shotTime, etc. on the projectile data so exploiters don’t create impossible projectiles). When a client receives a replicated projectile, simulate it similarly to how you simulate your own local projectiles.

For my projectile visuals, I use two attachments with a beam between them and alter the CurveSize0 and CurveSize1 to make it arc perfectly according to my projectile motion equation. I update the WorldPosition of these two attachments every frame, where one attachment is placed at deltaTime minus some amount to give the projectile some length.

You can see an example of what the beam projectile can look like in my testing place.

2 Likes