Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character
- local humanoidRootPart = character.HumanoidRootPart
- local head = character.Head
- local humanoid = character.Humanoid
- local playerStats = player:WaitForChild("PlayerStats")
- local hasShot = playerStats:WaitForChild("HasShot")
- local TweenService = game:GetService("TweenService")
- local tweenSpeedForCatch = 0.2
- local waitforacatchtime = 0.5
- local scriptEnabled = true
- local function tweenPlayerToBall(ball)
- if (humanoidRootPart.Position - ball.Position).Magnitude <= 25 then
- if ball.Position.Y >= head.Position.Y then
- humanoid:ChangeState(Enum.HumanoidStateType.Physics)
- humanoid:Move(Vector3.new(0, 50, 0))
- end
- game:GetService("ReplicatedStorage").Packages.Knit.Services.BallService.RE.Dive:FireServer()
- local animation = Instance.new("Animation")
- animation.AnimationId = "rbxassetid://18694494525"
- humanoid:LoadAnimation(animation):Play()
- TweenService:Create(humanoidRootPart, TweenInfo.new(tweenSpeedForCatch), { CFrame = ball.CFrame }):Play()
- end
- end
- hasShot.Changed:Connect(function(value)
- if value == true then
- scriptEnabled = false
- task.wait(1) -- Wait for 1 second after the shot before enabling again
- scriptEnabled = true
- end
- end)
- while task.wait(0) do
- if scriptEnabled then
- local ball = Workspace:FindFirstChild("Football") and Workspace.Football:FindFirstChild("Hitbox")
- if ball and (humanoidRootPart.Position - ball.Position).Magnitude <= 25 then
- tweenPlayerToBall(ball)
- task.wait(waitforacatchtime) -- Wait for the specified time before the next action
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment