Proper trails for bullets, using Fast Cast module?

I have just added the Fast Cast module to my game, but the trail is not starting from the origin, and instead the first raycast’s position. Any ideas to fix this?

Video (Origin is character’s head) :

FULL Server script:

local character = script.Parent
local fireEvent = game.ReplicatedStorage.ShootEvent
local reloadEvent = game.ReplicatedStorage.ReloadEvent
local fastCast = require(game.ReplicatedStorage.FastCastRedux)
local partCache = require(game.ReplicatedStorage.PartCache)
local bulletsFolder = workspace:FindFirstChild("BulletFolder") or"Folder", workspace)
bulletsFolder.Name = "BulletFolder"

local bulletTemplate = game.ReplicatedStorage.Bullet:Clone()

--local bulletTemplate ="Part")
--bulletTemplate.Anchored = true
--bulletTemplate.CanCollide = false
--bulletTemplate.Shape = "Ball"
--bulletTemplate.Size =, 0.25, 0.25)
--bulletTemplate.Material = Enum.Material.Metal

--local attach0 ="Attachment")
--attach0.Name = "Attachment0"
--attach0.Parent = bulletTemplate
--attach0.Position =, 0.055, 0)

--local attach1 ="Attachment")
--attach1.Name = "Attachment1"
--attach1.Parent = bulletTemplate
--attach1.Position =, -0.055, 0)

--local trailPart ="Trail")
--trailPart.Parent = bulletTemplate	
--trailPart.Attachment0 = bulletTemplate.Attachment0
--trailPart.Attachment1 = bulletTemplate.Attachment1
--trailPart.Lifetime = 0.1

--fastCast.VisualizeCasts = true

local caster =

local castParams =
castParams.FilterType = Enum.RaycastFilterType.Blacklist
castParams.IgnoreWater = true

local bulletCache =, 100, bulletsFolder)

castParams.FilterDescendantsInstances = {character, bulletsFolder}

local castBehaviour = fastCast:newBehavior()
castBehaviour.RaycastParams = castParams
castBehaviour.Acceleration =, - workspace.Gravity, 0)
castBehaviour.AutoIgnoreContainer = false
castBehaviour.CosmeticBulletContainer = bulletsFolder
castBehaviour.CosmeticBulletProvider = bulletCache

local totalAmmo = 5

local ammoLeft = totalAmmo
local reloading = false

script.Parent:SetAttribute("Reloading", false)

local function reload()
	if reloading then return end
	reloading = true
	script.Parent:SetAttribute("Reloading", true)
	ammoLeft = totalAmmo
	reloading = false
	script.Parent:SetAttribute("Reloading", false)

local function onLengthChanged(cast, lastPoint, direction, length, velocity, bullet)
	if bullet then
		local bulletLength = bullet.Size.Z / 2
		local offset =, 0, -(length - bulletLength))
		bullet.CFrame = CFrame.lookAt(lastPoint, lastPoint + direction):ToWorldSpace(offset)

local function onRayHit(cast, result, velocity, bullet)
	local hit = result.Instance
	local character = hit:FindFirstAncestorWhichIsA("Model")
	if character and character:FindFirstChild("Humanoid") then
	delay(2, function()

local function fire(player, shootPos, direction)
	if ammoLeft > 0 and not reloading then
		local origin = shootPos
		caster:Fire(origin, direction, 300, castBehaviour)
		ammoLeft -= 1


I don’t think it’s necessary, but I can add client side code if needed.

My best guess is that when the bullet visuals are first parented only after the first ray step has already taken place. If this however isn’t the case then check if StreamingEnabled is active, this may create slight delays in replication leading the client missing the first step :smiley:

I’m a little confused, I understand what the code does, but how can I implement it into my code? Im pretty new to fastCasts, so any help would be appreciated.