Need help with making Rays for my gun

So I am making a gun for my game and I am using raycasting. I wanted to bullets to look like they are actaully moving instead of a line just appearing. So I wanted to make it so that when the gun is shot the ray starts small at the barrel of the gun and the length just gets larger until it hits the target. However once I did that the ray was the right distance but it just went through the target and looked like this

The yellow line is the ray and the wall was the target. So what I did next was try to make the ray only go halfway, and it did make the ray a little closer but not very much so here is the code. position is the position of the target and distance is the distance from the barrel of the gun to the target.

bullet.CFrame = CFrame.new(origin, intersection)*CFrame.new(0, 0, -1)
	bullet.Parent = Workspace
	local speed = distance/50
	local tweenInfo = TweenInfo.new(speed,Enum.EasingStyle.Linear)
	local goal = {}
	goal.Position = Vector3.new(position.x, position.y, position.z/2)
	goal.Size = Vector3.new(.2,.2,distance)
	
	local TweenService = game:GetService("TweenService")

	local tween = TweenService:Create(bullet, tweenInfo, goal)
	tween:Play()
	

Try using FastCast or Changing the cframe based on the where it starts shooting to where the mouse is pointing to get the end position and change its frame based on that

Can you record it instead? I can’t grasp the movement of the bullet and it provide better information if you send a recording of the action.

robloxapp-20210507-1028310.wmv (341.3 KB)

This line right here depends on what your position variable is defined at, since it seems to stop weird