How do you make the present script depend on angle?

So I have a small script where t is time, v0 is starting velocity, x0 is starting position. As seen in the video, everything works pretty fine


for i = 1, 2, 0.5 do	
	local ball = workspace.Ball:Clone()
	ball.CFrame = workspace.Ball.CFrame
	ball.Parent = workspace
	ball.Transparency = 0

	local t = i
	local Target = workspace.Target

	local g =, -game.Workspace.Gravity, 0)
	local x0 = ball.Position

	local v0 = (Target.Position - x0 - 0.5*g*t*t)/t

	ball.AssemblyLinearVelocity =, v0.Y, v0.Z)


But what I want to do is to change the script so it depends on angle instead of time