FastCast what am I doing wrong?

  1. What do you want to achieve? Keep it simple and clear!
    Firing a bullet from the gun

  2. What is the issue? Include screenshots / videos if possible!
    I have a tutorial script and my own script
    I have narrowed down that the tutorial script can fire my premade bullet just fine but my script for some reason has a problem that the bullet not only gets stuck at the barrel and stays there but is also fired at the same time. And if fired multiple times there is a strange effect I can describe.

My script

Tutorial script

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Ive tried replacing the tutorial scripts into my model and have determined it is not the problem of my model but the actual script. I have tried looking closely at the script contents but they have little to no variation so I dont know what im doing wrong and I really need help. I want to be able to do this on my own without having to use a tutorial script.

Tutorial server script

local tool = script.Parent
local fireEvent = game.ReplicatedStorage.TSFWeapons.ServerEvents.GunFired
local FastCast = require(tool.FastCastRedux)
local firePoint = script.Parent.Barrel30.FirePoint30

local bulletsFolder = workspace:FindFirstChild("BulletFolder") or"Folder", workspace)
bulletsFolder.Name = "BulletFolder"

local bulletTemplate = game.Workspace.Bullets.Bullet30
--[[bulletTemplate.Anchored = true
bulletTemplate.CanCollide = false
bulletTemplate.Shape = "Ball"
bulletTemplate.Size =, 1, 1)
bulletTemplate.Material = Enum.Material.Metal]]

--FastCast.VisualizeCasts = true

local caster =

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

local castBehavior = FastCast.newBehavior()
castBehavior.RaycastParams = castParams
castBehavior.Acceleration =, -workspace.Gravity, 0)
castBehavior.AutoIgnoreContainer = false
castBehavior.CosmeticBulletContainer = bulletsFolder
castBehavior.CosmeticBulletTemplate = bulletTemplate

local function onEquipped()
	castParams.FilterDescendantsInstances = {tool.Parent, bulletsFolder}

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
	game:GetService("Debris"):AddItem(bullet, 2)

local function fire(player, mousePosition)
	local origin = firePoint.WorldPosition
	local direction = (mousePosition - origin).Unit
	caster:Fire(origin, direction, 1000, castBehavior)




My server script

local RS = game:GetService("ReplicatedStorage")
local GunFired = RS.TSFWeapons.ServerEvents.GunFired
local gun = script.Parent
local Spawn30 = script.Parent.Barrel30.FirePoint30
local Spawn120 = script.Parent.Barrel120.FirePoint120

local FastCast = require(gun.FastCastRedux)

local bulletsFolder = workspace:FindFirstChild("Bullets") or"Folder", workspace)
local bullet30 = bulletsFolder.Bullet30
--local bullet120 = bullets.Bullet120

local Caster =

--FastCast.VisualizeCasts = true
local CastParams =
CastParams.FilterType = Enum.RaycastFilterType.Blacklist
CastParams.IgnoreWater = true

local CastBehaviour = FastCast.newBehavior()
CastBehaviour.RaycastParams = CastParams
CastBehaviour.Acceleration =,-workspace.Gravity,0)
CastBehaviour.AutoIgnoreContainer = true
CastBehaviour.HighFidelityBehavior = FastCast.HighFidelityBehavior.Default

CastBehaviour.CosmeticBulletContainer = bulletsFolder
CastBehaviour.CosmeticBulletTemplate = bullet30

local function onEquipped()
	CastParams.FilterDescendantsInstances = {gun.Parent, bulletsFolder}

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

local function fire30(player, mousePos)
	local origin = Spawn30.WorldPosition
	local direction = (mousePos - origin).Unit
	print("Fired at ",mousePos)
	Caster:Fire(origin,direction,100, CastBehaviour)


scripts have been modified to fire the same bullet. The hit detection has been removed to prove that this not a hit detection issue.