Making Guns for my game and thought it would look nice if the trail follows the bullet so I tweened the bullet and a trail but for some reason the trail isn’t connected to the bullet and it’s far away from the gun. Here is a video to show what I mean
Without the position and orgin variable values I can’t be of any use to you. However, instead of creating a new instance and trail for the bullet I would recommend manually setting up the trail and attachments inside the original bullet itself and making sure that it works. Then whenever you clone the bullet it will clone with the attachments and trail. Make sure the trail is a child of the original bullet though.
However, if you are dead-set on creating new attachments for each individual bullet you clone then you should use this:
local bulletTemplate = ServerStorage.Bullet
local orgin = Vector3.new(bulletTemplate.Size.X * 0.5, 0, bulletTemplate.Size.Z * 0.5)
local position = Vector3.new(bulletTemplate.Size.X * -0.5, 0, bulletTemplate.Size.Z * 0.5)
In your code you use CFrame.new(origin, intersection). This feature has been deprecated for the new constructor. You should instead use CFrame.lookAt(orgin, intersection).
Also, it’s usually a not good practice to create new instances whenever you create a gun, as this can cause lag or reduced performance. Instead it’s a good practice to use PartCache, for all your quick part-creation needs for this, as it will reduce lag caused by instancing and reparenting greatly.
Origin is the barrel of the gun and position is where the bullet will end up. I tried just manually making the attachments and trails but it is still the same result. Any other ideas?
You should create the attachments as children of the bullet. Use Vector3.new(bulletTemplate.Size.X * 0.5, 0, bulletTemplate.Size.Z * 0.5) on one attachment for its position and Vector3.new(bulletTemplate.Size.X * -0.5, 0, bulletTemplate.Size.Z * 0.5) on the other.
For some reason I can’t upload a video but its pretty much the same result just the trail is different because I used the part you sent. Do you want me to send the whole gun I am using. By the way thanks for the help you have been giving me I appreciate it.