local function diveTowards(targetPos)
if diving or diveCooldown or hasBall then return end
diving = true
diveCooldown = true
hasBall = true
humanoid.PlatformStand = true
local direction = (targetPos - keeperRoot.Position)
direction = clampVectorMagnitude(direction, divePowerLimit)
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = direction / diveDuration
bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
bodyVelocity.P = 10000
bodyVelocity.Parent = keeperRoot
task.delay(diveDuration, function()
bodyVelocity:Destroy()
keeperRoot.AssemblyLinearVelocity = Vector3.zero
keeperRoot.AssemblyAngularVelocity = Vector3.zero
if ball:FindFirstChild("KeeperBallWeld") then
ball.KeeperBallWeld:Destroy()
end
ball.Anchored = false
ball.CanCollide = false
ball.AssemblyLinearVelocity = Vector3.zero
ball.AssemblyAngularVelocity = Vector3.zero
local weld = Instance.new("WeldConstraint")
weld.Name = "KeeperBallWeld"
weld.Part0 = keeperRoot
weld.Part1 = ball
weld.Parent = ball
ball.Position = keeperRoot.Position + Vector3.new(0, -2, -1.5)
task.delay(3, function()
if weld and weld.Parent then
weld:Destroy()
end
ball.CanCollide = true
ball:ApplyImpulse(keeperRoot.CFrame.LookVector * 50 + Vector3.new(0, 20, 0))
hasBall = false
end)
humanoid.PlatformStand = false
diving = false
task.delay(diveCooldownTime, function()
diveCooldown = false
end)
end)
end
When the keeper touches the ball, it welds to keeper, but the keeper starts flinging everywhere.