Advertisement
DARKMODZ

blade balls more like shave your balls

Nov 15th, 2023
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. ToggleKey = ToggleKey or Enum.KeyCode.Q;
  2.  
  3. local Cloneref = cloneref or function(Object)return Object end;
  4.  
  5. local StatsService = Cloneref(game:GetService("Stats"));
  6. local UserInputService = Cloneref(game:GetService("UserInputService"));
  7. local ReplicatedStorage = Cloneref(game:GetService("ReplicatedStorage"));
  8. local Players = Cloneref(game:GetService("Players"));
  9. local Player = Players.LocalPlayer;
  10.  
  11. local Running = true;
  12. local Saved = {
  13. LastTick = os.clock();
  14. LastBallPosition = nil;
  15. AttemptedParry = false,
  16. };
  17.  
  18. local function GetBall()
  19. local RealBall, OtherBall = nil, nil;
  20. for Int, Object in pairs(workspace.Balls:GetChildren()) do
  21. if Object:GetAttribute("realBall") == true then
  22. RealBall = Object;
  23. else
  24. OtherBall = Object;
  25. end;
  26. end;
  27. return RealBall, OtherBall;
  28. end;
  29. local function AttemptParry(OtherBall)
  30. ReplicatedStorage.Remotes.ParryAttempt:FireServer(1.5, OtherBall.CFrame, (function()
  31. local Results = {};
  32. for Int, Character in pairs(workspace.Alive:GetChildren()) do
  33. Results[Character.Name] = Character.HumanoidRootPart.Position;
  34. end;
  35. return Results;
  36. end)(), {math.random(100, 999), math.random(100, 999)});
  37. end;
  38.  
  39. UserInputService.InputBegan:Connect(function(Input, GameProcessed)
  40. if GameProcessed == false then
  41. if Input.KeyCode == ToggleKey then
  42. Running = not Running;
  43. end;
  44. end;
  45. end);
  46.  
  47. while task.wait() do
  48. if Running == true then
  49. print("yes its running")
  50. local RealBall, OtherBall = GetBall();
  51. if RealBall ~= nil and OtherBall ~= nil then
  52. if Saved.LastBallPosition ~= nil then
  53. if RealBall:GetAttribute("target") == Player.Name then
  54. local DeltaT = os.clock()-Saved.LastTick;
  55. local VelocityX = (OtherBall.Position.X-Saved.LastBallPosition.X)/DeltaT;
  56. local VelocityY = (OtherBall.Position.Y-Saved.LastBallPosition.Y)/DeltaT;
  57. local VelocityZ = (OtherBall.Position.Z-Saved.LastBallPosition.Z)/DeltaT;
  58. local VelocityMagnitude = math.sqrt(VelocityX^2+VelocityY^2+VelocityZ^2);
  59.  
  60. local ServerPing = StatsService.Network.ServerStatsItem["Data Ping"]:GetValue();
  61. local DistanceToPlayer = (Player.Character.HumanoidRootPart.Position-OtherBall.Position).Magnitude;
  62. local EstimatedTimeToReachPlayer = (ServerPing/VelocityMagnitude)/(ServerPing/DistanceToPlayer);
  63. local TimeToParry = 0.2*(VelocityMagnitude/DistanceToPlayer);
  64.  
  65. print(EstimatedTimeToReachPlayer, "<=", TimeToParry);
  66.  
  67. if tostring(EstimatedTimeToReachPlayer) ~= "inf" and TimeToParry < 10 then
  68. if EstimatedTimeToReachPlayer <= TimeToParry then
  69. if Saved.AttemptedParry == false then
  70. warn("Fire");
  71. AttemptParry(OtherBall);
  72. Saved.AttemptedParry = true;
  73. else
  74. warn("Attempted");
  75. end;
  76. else
  77. Saved.AttemptedParry = false;
  78. end;
  79. end;
  80. else
  81. Saved.AttemptedParry = false;
  82. end;
  83. end;
  84. Saved.LastBallPosition = OtherBall.Position;
  85. end;
  86. end;
  87. Saved.LastTick = os.clock();
  88. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement