Help with dribbling system

I am here to ask for help in my code. In this code it has both LookVector which makes the ball power and UpVector which handles the height. Now i am having trouble adding curve to the script and i want to know how to do the curving of the ball.

local Module = {
	Cooldown = false,
	Touched = false,
	
	Time = 0.5
}

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:FindFirstChild("Humanoid")

local Debris = game.Debris
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:FindFirstChild("Event")
local Game = ReplicatedStorage:FindFirstChild("Game")
local Animation = Game.Anims.Tools.Dribble.Precision
local Manage = Character:WaitForChild("Manage")
local Foot = Manage.Foot.Value

local Track = Humanoid:LoadAnimation(Animation:FindFirstChild(Foot))

function Module.Main()
	if Module.Cooldown == false then
		Module.Cooldown = true
		Track:Play()
		
		spawn(function()
			if Module.Touched == false then
				for _, v in pairs(Character:GetChildren()) do
					if v:IsA("MeshPart") then
						
						local Connection
						local Connections = {}
						
						if Player.Character.HumanoidRootPart:FindFirstChild("BodyVelocity") then
							Player.Character.HumanoidRootPart:FindFirstChild("BodyVelocity"):Destroy()
						end
						
						Module.Touched = true
						
						Connection = v.Touched:Connect(function(Ball)
							if Ball.Name == "futsal" then
								Module.Touched = false
								for _, Velocitys in pairs(Ball:GetChildren()) do
									if Velocitys:IsA("BodyVelocity") then
										Velocitys:Destroy()
									end
								end
								local Velocity = Instance.new("BodyVelocity", Ball)
								Velocity.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 21 + Character.HumanoidRootPart.CFrame.UpVector * 2.1
								Velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
								
								Debris:AddItem(Velocity, 0.3)
								
								for x, y in pairs(Character:GetChildren()) do
									if y:IsA("MeshPart") or y:IsA("Part") then
										local noCollision = Instance.new('NoCollisionConstraint', Ball)
										noCollision.Part0 = Ball
										noCollision.Part1 = y
										Debris:AddItem(noCollision, 0.4)
									end
								end
								
								Event:FireServer("NetWorkOwner", Ball, "shooting")
							end
						end)
						
						
						table.insert(Connections, Connection)
						

						task.delay(Module.Time, function()

							if Connection then
								Connection:Disconnect()
								Connections[1]:Disconnect()
							end

							Module.Touched = false
							Module.Cooldown = false
							
							
						
						end)
					end
				end
			end
		end)
	end
end

return Module
1 Like