This is the code Iâ€™m using xd:

If you uncomment the part at the end then it will use the formula to find the min initial speed but it doesnâ€™t work at all.

```
--By Axis Angle
--function Trajectory(Vector3 Origin,Vector3 Target,Number InitialVelocity)
--Returns two possible paths from Origin to Target where the magnitude of the initial velocity is InitialVelocity
--The first returned Vector3 is the Low Trajectory, the second Vector3 is the High Trajectory
--If no trajectory can be calculated, it returns nil
local Trajectory
do
local v3=Vector3.new
local g=-196.2
function Trajectory(Origin,Target,InitialVelocity)
local ox,oy,oz=Origin.x,Origin.y,Origin.z
local rx,rz=Target.x-ox,Target.z-oz
local tx2=rx*rx+rz*rz
local ty=Target.y-oy
if tx2>0 then
local v2=InitialVelocity*InitialVelocity
local c0=tx2/(2*(tx2+ty*ty))
local c1=g*ty+v2
local c22=v2*(2*g*ty+v2)-g*g*tx2
if c22>0 then
local c2=c22^0.5
local t0x2=c0*(c1+c2)
local t1x2=c0*(c1-c2)
local tx,t0x,t1x=tx2^0.5,t0x2^0.5,t1x2^0.5
local v0x,v0y,v0z=rx/tx*t0x,(v2-t0x2)^0.5,rz/tx*t0x
local v1x,v1y,v1z=rx/tx*t1x,(v2-t1x2)^0.5,rz/tx*t1x
local v0=v3(v0x,ty>g*tx2/(2*v2) and v0y or -v0y,v0z)
local v1=v3(v1x,v1y,v1z)
return v0,v1
end
else
local v=v3(0,InitialVelocity*(ty>0 and 1 or ty<0 and -1 or 0),0)
return v,v
end
end
end
--Example
wait(1)
local g = 196.2
local Origin=Vector3.new(0,10,0)
local TargetPart=game.Players.LocalPlayer.Character.HumanoidRootPart
local InitialSpeed=100
while true do
wait()
local target = TargetPart.Position
--[[local x = ((target.X - Origin.X)^2 + (target.Z - Origin.Z)^2)^0.5
local y = (target.Y - Origin.Y)
local InitialSpeed = ((y + (y^2 + x^2))^0.5/g)^0.5]]
local LowTrajectory,HighTrajectory=Trajectory(Origin,target,InitialSpeed)
local Part=Instance.new("Part",game.Workspace)
Part.CanCollide=false
Part.Position=Vector3.new(0,10,0)
Part.Velocity=LowTrajectory
local Part=Instance.new("Part",game.Workspace)
Part.CanCollide=false
Part.Position=Vector3.new(0,10,0)
Part.Velocity=HighTrajectory
end
```