Advertisement
SigmaBoy456

Godlike Fighter Bot

Sep 14th, 2024 (edited)
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. local difficult = 250
  2. local sharpstab = 11
  3.  
  4. local player = game.Players.LocalPlayer
  5. local character = player.Character
  6. local localroot = character:WaitForChild("HumanoidRootPart")
  7. local humanoid = character:WaitForChild("Humanoid")
  8. local autoclick = game:GetService("VirtualUser")
  9. local range = 99999999
  10. local ver
  11.  
  12. local function closest()
  13. local target = nil
  14. local closestDist = range
  15. for _, v in pairs(game.Players:GetPlayers()) do
  16. if v ~= player and v.Character and not v.Character:FindFirstChildWhichIsA("ForceField") then
  17. local JN = v.Character:FindFirstChild("HumanoidRootPart")
  18. if JN then
  19. local distOne = (localroot.Position - JN.Position).magnitude
  20. if distOne < closestDist then
  21. target = v.Character
  22. closestDist = distOne
  23. end
  24. end
  25. end
  26. end
  27. return target
  28. end
  29.  
  30. while game:GetService("RunService").RenderStepped:Wait() do
  31. local newtarget = closest()
  32. if newtarget and not newtarget:FindFirstChildWhichIsA("ForceField") then
  33. local vroot = newtarget:FindFirstChild("HumanoidRootPart")
  34. local vhum = newtarget:FindFirstChildOfClass("Humanoid")
  35. if vroot and vhum and vhum.Health > 0 then
  36. local dist = (localroot.Position - vroot.Position).magnitude
  37. if dist < range then
  38. if ver then
  39. ver:Destroy()
  40. end
  41.  
  42. -- BodyVelocity
  43. ver = Instance.new("BodyVelocity")
  44. ver.MaxForce = Vector3.new(10000, 10000, 10000) -- Allow flying in all directions
  45. ver.Velocity = (vroot.Position - localroot.Position).unit * difficult
  46. ver.Parent = localroot
  47.  
  48. -- Change humanoid
  49. humanoid:ChangeState(Enum.HumanoidStateType.Physics)
  50.  
  51. -- Update HumanoidRootPart CFrame
  52. localroot.CFrame = CFrame.lookAt(localroot.Position, vroot.Position) * CFrame.Angles(0, math.rad(sharpstab), 0)
  53. game:GetService("RunService").RenderStepped:Wait()
  54.  
  55. -- recalculate distance
  56. dist = (localroot.Position - vroot.Position).magnitude
  57. if dist >= range or vhum.Health <= 0 then
  58. ver:Destroy()
  59. humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) -- Change state
  60. break
  61. end
  62. end
  63. end
  64. end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement