So, Whenever i try to curve the ball, It offsets from the target humanoidrootpart. This is rather annoying since the target wont be able to parry if the ball if offset beyond their parrying range.
Could anyone help me with this?
local function startFollowing()
local startTime = tick()
runs.Heartbeat:Connect(function(delta)
if targetCharacter then
local targetHRP = targetCharacter:WaitForChild("HumanoidRootPart")
local currentPosition = ball.Position
local direction = (targetHRP.Position - currentPosition).unit
local speed = initialSpeed + (acceleration * accelerationMultiplier) * (tick() - startTime)
local newDirection = (direction + playerCameraDirection).unit
pcall(function()
targetCharacter:FindFirstChild("SelectedPlrHighlight").Enabled = true
end)
local newPosition = currentPosition + newDirection * speed
if newPosition.Y < minY then
newPosition = Vector3.new(newPosition.X, minY, newPosition.Z)
end
ts:Create(ball, TweenInfo.new(delta, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), { Position = newPosition }):Play()
end
end)
end
startFollowing()