Best way to shoot a projectile?

I want to know what is the best way to shoot a projectile. My current code is from this post: Articles/Modeling a Projectile's Motion.md at master · EgoMoose/Articles · GitHub

My current code:

local g = Vector3.new(0,-100,0) -- gravity
local x0 = attachment.WorldPosition -- position to shoot from
local t = 1 -- Time to destination

local v0 = (hitPosition - x0 - 0.5*g*t*t)/t

local projectile = projectile:Clone()
projectile.Parent = workspace

local nt = 0

coroutine.wrap(function()
	while (nt < t*2) do
		if projectile.PrimaryPart ~= nil then
			projectile:PivotTo(CFrame.new(0.5*g*nt*nt + v0*nt + x0, projectile.PrimaryPart.AssemblyLinearVelocity + projectile.PrimaryPart.Position))
		end
		nt = nt + RunService.Heartbeat:Wait()
	end

	if projectile ~= nil then
		projectile:Destroy()
	end
end)()

My projectile is a model.
My code also lags the game.

Try FastCast. It’s a lot more user friendly and makes projectile physics easy.

That is way to hard for me to change the code to use FastCast.