Help with tweening a raycast bullet in a single direction for effect

I’m working on a new third-person weapon system and I’m going for a new bullet look, I’ve been playing the game Eclipsis and I absolutely love the bullet travel style they use and I’m interested in trying to do something like it, though I cannot seem to figure out how to tween the bullet (test part) in a single direction and it comes out completely incorrect. I’m still learning CFrame, Size, and Position with TweenService so this is more on the difficult side for me. Any help is appreciated. (I’ve already finished the weapon system, this is purely for effect)

Here is what my test effect looks like:

local p = workspace.Part
local ts = game:GetService("TweenService")
while wait(0.6) do
	ts:Create(p,,{Size = - 100,p.Size.Y,p.Size.Z)}):Play()
	ts:Create(p,,{Size = + 100,p.Size.Y,p.Size.Z)}):Play()

I am trying to get the bullet to tween to a single point size-wise, like this:

What you need first is to obtain the point of origin and the point of target, your origin being the end of the gun barrel and the target being the point of your mouse hit.
Then you will need to cast a ray from the origin to the target
Lastly you place the bullet between the origin (end of gun barrel) and the ray hit position.

Let me help you with a demo,
If you put 3 parts in workspace and call them origin, target and bullet respectively and put a cylindermesh in the bullet you can start off with this piece of code:

origin = game.Workspace.origin
target =
bullet = game.Workspace.bullet
ignore = {} -- ignore list, put whatever you need in here that needs to be ignored
ray =,(target.CFrame.p - origin.CFrame.p).unit * 150) -- initialize ray class from origin to target (the 150 is the max. range of the ray)
hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignore) -- cast the ray (hit = part that the ray hit, position = the position of where the ray hit)

distance = (origin.Position-position).Magnitude
bullet.Size =,0.5,0.5) 
bullet.CFrame =,target.Position)*,0,-distance/2)*CFrame.Angles(0,math.rad(90),0) -- angles is to correct the orientation for the cylinder mesh

After that you should shrink the bullet.
I hope you can get started with this.

1 Like

Thank you for your reply! I will try this out.

1 Like