iOSdeveloper

Untitled

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