Problem with fastcast

  1. What do you want to achieve? I want my bullet to spawn in the muzzle.

  2. What is the issue?

  3. What solutions have you tried so far? I was trying to find a solution on the devforum.

How do I make the bullet fly straight out of the muzzle? For now its spawning a little further than necessary.

--Server script
	local cast =
	local behavior = fastcast.newBehavior()

	local params =
	params.FilterDescendantsInstances = {plr.Character}
	params.FilterType = Enum.RaycastFilterType.Exclude

	behavior.RaycastParams = params
	behavior.Acceleration =,-workspace.Gravity/2, 0)
	behavior.AutoIgnoreContainer = true
	behavior.CosmeticBulletTemplate = ReplicatedStorage.Bullets.Bullet
	behavior.CosmeticBulletContainer = workspace.Projectiles
	cast.LengthChanged:Connect(function(ActiveCast, lastPoint, rayDir, displacement, segmentVelocity, cosmeticBulletObject)
		if cosmeticBulletObject then
			local bulletLength = cosmeticBulletObject.Size.Z / 2
			local offset =,0, -(displacement - bulletLength))
			cosmeticBulletObject.CFrame = CFrame.lookAt(lastPoint, lastPoint + rayDir):ToWorldSpace(offset)

	cast.RayHit:Connect(function(ActiveCast, RaycastResult, segmentVelocity, cosmeticBulletObject)
		local hit = RaycastResult.Instance

	local direction = (mouse-muzzlePos)

	cast:Fire(muzzlePos, direction, 300, behavior)

Thats just a visual issue because of the high speed of the projectile. Set VisualizeCasts to true to see the trajectory of the cast and you’ll see that it comes out the muzzle

Yes, but how can I fix it? Is it possible?

Not that i know of, you can only slow down the projectile.