Ending a ray with FastCast?

Hello! I am using the FastCast module to make my game and I would like to know if there is a way to instantly make the ray end. Thanks in advance!

1 Like

This is covered in the API documentation over at FastCast API (see ActiveCast:Terminate()).

I tried using :Terminate(), but I can not figure out what value is the ActiveCast

Caster.LengthChanged:Connect(function(Cast, LastPoint, Direction, Length, Velocity, Bullet)
	if Bullet then
		if (LastPoint - NewTower.TurnPart.Position).Magnitude <= (TowerSheet.TowerShootingRange[TowerListNumber] / 2) then
			local BulletLength = Bullet.Size.Z / 2
			local Offset = CFrame.new(0, 0, -(Length - BulletLength))
			Bullet.CFrame = CFrame.lookAt(LastPoint, LastPoint + Direction):ToWorldSpace(Offset)
		else
			--Terminate Here
			print("Ray Terminated for out of range!")
		end
	end
end)
1 Like

Well a word of advice, you gave it a fitting name. Cast is the variable storing the ActiveCast instance.

I replaced “–Terminate Here” with Cast:Terminate() and I am getting this error,
image

1 Like