iOSdeveloper

Untitled

Jan 22nd, 2025
18,981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local character = player.Character
  3. local humanoidRootPart = character.HumanoidRootPart
  4. local head = character.Head
  5. local humanoid = character.Humanoid
  6. local playerStats = player:WaitForChild("PlayerStats")
  7. local hasShot = playerStats:WaitForChild("HasShot")
  8. local TweenService = game:GetService("TweenService")
  9.  
  10. local tweenSpeedForCatch = 0.2
  11. local waitforacatchtime = 0.5
  12. local scriptEnabled = true
  13.  
  14. local function tweenPlayerToBall(ball)
  15. if (humanoidRootPart.Position - ball.Position).Magnitude <= 25 then
  16. if ball.Position.Y >= head.Position.Y then
  17. humanoid:ChangeState(Enum.HumanoidStateType.Physics)
  18. humanoid:Move(Vector3.new(0, 50, 0))
  19. end
  20. game:GetService("ReplicatedStorage").Packages.Knit.Services.BallService.RE.Dive:FireServer()
  21. local animation = Instance.new("Animation")
  22. animation.AnimationId = "rbxassetid://18694494525"
  23. humanoid:LoadAnimation(animation):Play()
  24. TweenService:Create(humanoidRootPart, TweenInfo.new(tweenSpeedForCatch), { CFrame = ball.CFrame }):Play()
  25. end
  26. end
  27.  
  28. hasShot.Changed:Connect(function(value)
  29. if value == true then
  30. scriptEnabled = false
  31. task.wait(1) -- Wait for 1 second after the shot before enabling again
  32. scriptEnabled = true
  33. end
  34. end)
  35.  
  36. while task.wait(0) do
  37. if scriptEnabled then
  38. local ball = Workspace:FindFirstChild("Football") and Workspace.Football:FindFirstChild("Hitbox")
  39. if ball and (humanoidRootPart.Position - ball.Position).Magnitude <= 25 then
  40. tweenPlayerToBall(ball)
  41. task.wait(waitforacatchtime) -- Wait for the specified time before the next action
  42. end
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment