Hi, so I am making an NPC that shoots people. I am using raycasts, and I create a bulelt part and set it as the raycast’s final position and that gives me the trail. But there is one problem. It isn’t smooth. So when the NPC shoots, the bullet trail just appears but it doesnt appear smoothly.
My friend told me to fire several rays consecutively and then move the part along it, but I dont know how I would do this. Is there an easier way to do it?
local RaycastResult = workspace:Raycast(Bot:FindFirstChild('Right Arm').Position, (target.Position - Bot:FindFirstChild('Right Arm').Position) * 300, raycastParams)
if RaycastResult then
local distance = (Bot:FindFirstChild('Right Arm').Position - RaycastResult.Position).Magnitude
bullet.Anchored = true
bullet.CanCollide = false
bullet.Size = Vector3.new(0.1, 0.1, distance)
bullet.CFrame = CFrame.lookAt(Bot:FindFirstChild('Right Arm').Position, RaycastResult.Position)*CFrame.new(0, 0, -distance/2)
So you aren’t really creating a bullet, you are creating a trail Part.
I’m guessing you want it to appear to move like a bullet.
Try using the Search button up top with items like ‘bullet path trail’, ‘ball trail’, ‘artillery trail’ or ‘projectile trail’. I’m sure you may find something there that creates a moving bullet with a trail effect.
I dont want to use tween service because it would lag on the server.
The ‘bullet trail’ thread (How would i make a Bullet Trail?) is suggesting that I fire 4-5 raycasts, but that was my question in the first place, how would I fire multiple raycasts?
Not sure.
Couldn’t you do the same thing you are doing, but just divide the distance by 10 and use 1 part that’s 1/10th the distance? Then you could calculate the points it should CFrame to along that line.