Need Help With Making Bullet Tracers

How Would I be able to make a bullet tracer with raycast? I need some help.

https://streamable.com/v2aqnv

THIS IS THE SERVER

game.ReplicatedStorage.Events.Shoot.OnServerEvent:Connect(function(player, MuzzlePos, lookPos, damage, headshot)
	if player.Character then
		local sound = player.Character.UpperTorso:FindFirstChild("FireSound")

		if sound then
			sound:Play()
		end
		
		local origin = MuzzlePos
		local direction = (lookPos - origin).Unit*300
		local result = Workspace:Raycast(origin, direction)

		local intersection = result and result.Position or origin + direction
		local distance = (origin - intersection).Magnitude
		
		local bullet_clone = ServerStorage.Bullet:Clone()
		bullet_clone.Size = Vector3.new(0.1, 0.1, distance)
		bullet_clone.CFrame = CFrame.new(origin, intersection)*CFrame.new(0, 0, -distance/2)
		bullet_clone.Parent = Workspace
		
		
		bullet_clone:SetNetworkOwner(player)

		bullet_clone.Touched:Connect(function(hit)
			bullet_clone:Destroy()

			if hit.Parent ~= player.Character then
				if hit then
					if hit.Parent:FindFirstChild("Humanoid") then
						if hit.Name == "Head" then
							hit.Parent:FindFirstChild("Humanoid"):TakeDamage(headshot)
						else
							hit.Parent:FindFirstChild("Humanoid"):TakeDamage(damage)

						end
					end
				end
			end
			
			--	print(distance)
			if distance > 50 then
				game.ReplicatedStorage:WaitForChild("BulletTracer"):FireAllClients(result, MuzzlePos, lookPos)
			else
				coroutine.wrap(function()
					local distance = (player.Character.PrimaryPart.Position - lookPos).Magnitude
					if distance > 50 then
						game.ReplicatedStorage:WaitForChild("BulletTracer"):FireAllClients(MuzzlePos+(lookPos-MuzzlePos).Unit*50, MuzzlePos, lookPos)
					end
				end)()
			end

		end)

		wait(15)
		bullet_clone:Destroy()
	end
end)

This is the Client

function Shoot()
	if framework.module.fireMode == "Semi" then
		fireAnim:Play()
		reloadAnim:Stop()
		emptyreloadAnim:Stop()
		inspectAnim:Stop()
		idleAnim:Stop()
		

		
		if framework.module.ammo == 1 then
			fireAnim:Stop()
			emptyfireAnim:Play()
			--empty idle here if i add it
		else
			emptyfireAnim:Stop()
			fireAnim:Play()
		end
		
		framework.module.ammo -= 1

		game.ReplicatedStorage.Events.Shoot:FireServer(framework.viewmodel.Importants.Muzzle.Position, mouse.Hit.p, framework.module.damage, framework.module.headshot)
		
		if framework.module.ammo == 0 then
			task.wait(.15)
			Reload()
			repeat task.wait() until emptyreloadAnim.IsPlaying == false
			debounce = false
		else
			debounce = true

			wait(framework.module.debounce)

			debounce = false
		end
	end

	if framework.module.fireMode == "Full Auto" then
		isShooting = true
	end
end
	if isShooting and framework.module.ammo > 0 and isReloading ~= true and canShoot == true then
		fireAnim:Play()
		reloadAnim:Stop()
		emptyreloadAnim:Stop()
		inspectAnim:Stop()
		idleAnim:Stop()

		
		--// SPRING 			

		if framework.module.ammo == 1 then
			fireAnim:Stop()
			emptyfireAnim:Play()
		else
			emptyfireAnim:Stop()
			fireAnim:Play()
		end

		framework.module.ammo -= 1

		game.ReplicatedStorage.Events.Shoot:FireServer(framework.viewmodel.Importants.Muzzle.Position, mouse.Hit.p, framework.module.damage, framework.module.headshot, framework.viewmodel.Importants.Muzzle)

		if framework.module.ammo == 0 then
			task.wait(.15)
			Reload()
		end
		mouse.Button1Up:Connect(function()
			isShooting = false
		end)

		wait(framework.module.fireRate)
	end
end

local function createBulletTracer(resultP, origin, mouseP)
	local gunSettings = framework.module
	local bullet = game.ReplicatedStorage.Miscs.Projectiles.NewBullet:WaitForChild("Bullet"):Clone()
	local randomCurvature = Random.new():NextNumber(gunSettings.BulletCurvature[1],gunSettings.BulletCurvature[2])
	local randomSize = Random.new():NextNumber(gunSettings.BulletLength[1],gunSettings.BulletLength[2])
	bullet.CFrame = CFrame.new(origin, resultP)
	bullet.At.Beam.CurveSize0 = randomCurvature
	bullet.At.Beam.CurveSize1 = -randomCurvature
	bullet.At.Beam.Width0 = gunSettings.BulletWidth
	bullet.At.Beam.Width1 = gunSettings.BulletWidth
	bullet.At.Position = Vector3.new(0,0,-randomSize)
	bullet.Attachment.Position = Vector3.new(0,0,randomSize)
	bullet.Parent = workspace.Bullets
	bullet.CollisionGroup = "Miscellaneous"
	local TI = TweenInfo.new(gunSettings.BulletSpeed, Enum.EasingStyle.Quad)
	local property = {Position = resultP}
	local a = game:GetService("TweenService"):Create(bullet,TI, property)
	a:Play()
	a.Completed:Wait()
	bullet:Destroy()
end

Have you tried using a trail yet?

yeah bro i have its in the video

Well then I can’t see it, maybe that’s the problem.