webhook_forbladeball

crAXCKRDED

Nov 6th, 2023
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.73 KB | None | 0 0
  1.  
  2. game:GetService("StarterGui"):SetCore("DevConsoleVisible",true); warn("Exed")
  3.  
  4. local workspace = game:GetService("Workspace")
  5. local RunService = game:GetService("RunService")
  6.  
  7. local Players = game:GetService("Players")
  8. local Local = Players.LocalPlayer
  9.  
  10. local Camera = workspace.CurrentCamera
  11. local Balls = workspace:WaitForChild("Balls")
  12.  
  13. getgenv().Signal = Signal or {}
  14.  
  15. function PlayerPoints()
  16. local tbl = {}
  17. for i, v in pairs(Players:GetPlayers()) do
  18. local UserId, HumanoidRootPart = tostring(v.UserId), v.Character and v.Character:FindFirstChild("HumanoidRootPart")
  19. if HumanoidRootPart and v == Local then
  20. warn(v)
  21. tbl[UserId] = Camera:WorldToScreenPoint(HumanoidRootPart.Position)
  22. end
  23. end
  24.  
  25. print(unpack(tbl))
  26. table.foreach(tbl, print)
  27. return tbl
  28. end
  29.  
  30. function Parry()
  31. if Local.Character then
  32. local Remote = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("ParryAttempt")
  33. local WorldToScreenPoint = Camera:WorldToScreenPoint(Local.Character.HumanoidRootPart.Position)
  34. local args = {
  35. [1] = 0.5,
  36. [2] = workspace.CurrentCamera.CFrame,
  37. [3] = PlayerPoints(),
  38. [4] = {
  39. [1] = WorldToScreenPoint.X,
  40. [2] = WorldToScreenPoint.Y
  41. }
  42. }
  43.  
  44. warn("Players:", unpack(args[3]))
  45. Remote:FireServer(unpack(args))
  46. end
  47. end
  48.  
  49. local Debounce, LastPlayer, LastTime = false
  50. function Anticipate(Time)
  51. if Debounce then return end
  52.  
  53. if LastTime then
  54. local Sum = (Time - LastTime)
  55. if (Sum >= -25 and Sum <= 25) then
  56. print("Anticipated Time:", Sum, "Time:", Time, "LastTime:", LastTime)
  57. if Sum >= 25 or Sum <= -25 then
  58. return true
  59. end
  60. end
  61. end
  62.  
  63. LastTime = Time
  64. end
  65.  
  66. -- Function to calculate the time for projectile to reach a target
  67. function calculateProjectileTime(initialPosition, targetPosition, initialVelocity)
  68. local distance = (targetPosition - initialPosition).Magnitude
  69. local time = distance / initialVelocity.Magnitude
  70. return time
  71. end
  72.  
  73. -- Function to calculate the distance between projectile and object
  74. function calculateDistance(projectilePosition, objectPosition)
  75. return math.abs((projectilePosition - objectPosition).Magnitude)
  76. end
  77.  
  78. -- Function to check if the object can intercept (parry) the projectile
  79. function canObjectParry(projectilePosition, objectPosition, projectileVelocity, objectVelocity)
  80. local timeToIntercept = calculateProjectileTime(projectilePosition, objectPosition, projectileVelocity)
  81. local distanceToIntercept = calculateDistance(projectilePosition + projectileVelocity * timeToIntercept, objectPosition + objectVelocity * timeToIntercept)
  82. local Anticipate = Anticipate(timeToIntercept)
  83.  
  84. print("CanParry:", distanceToIntercept, timeToIntercept, Anticipate)
  85.  
  86. local conditions = {
  87. (Anticipate and distanceToIntercept <= 75);
  88. (distanceToIntercept >= 35 and distanceToIntercept <= 50 and timeToIntercept <= 0.6);
  89. (distanceToIntercept >= 50 and distanceToIntercept <= 75 and timeToIntercept >= 0.6 and timeToIntercept <= 0.75);
  90. (distanceToIntercept <= 35 and timeToIntercept <= 0.5);
  91. (distanceToIntercept <= 12.5 and timeToIntercept >= 0.5 and timeToIntercept <= 0.75);
  92. (distanceToIntercept <= 0.025 and timeToIntercept <= 0.75);
  93. (distanceToIntercept >= 75 and distanceToIntercept <= 100 and timeToIntercept <= 0.5);
  94. }
  95.  
  96. local r
  97. for i, v in pairs(conditions) do
  98. if v == true then
  99. warn(i, v)
  100. r = true
  101. end
  102. end
  103.  
  104. if r then return true end
  105. end
  106.  
  107. function chooseNewFocusedBall()
  108. local balls = workspace.Balls:GetChildren()
  109. for _, ball in ipairs(balls) do
  110. if ball:GetAttribute("realBall") ~= nil and ball:GetAttribute("realBall") == true then
  111. focusedBall = ball
  112. break
  113. elseif ball:GetAttribute("target") ~= nil then
  114. focusedBall = ball
  115. break
  116. end
  117. end
  118.  
  119. return focusedBall
  120. end
  121.  
  122. function foreach(Ball)
  123. local Ball = chooseNewFocusedBall()
  124. if (Ball) and not Debounce then
  125. for i, v in pairs(Signal) do table.remove(Signal, i); v:Disconnect() end
  126. local function Calculation(Delta)
  127. local Start, HumanoidRootPart, Player = os.clock(), Local.Character and Local.Character:FindFirstChild("HumanoidRootPart"), Players:FindFirstChild(Ball:GetAttribute("target"))
  128. if (Ball and Ball:FindFirstChild("zoomies") and Ball:GetAttribute("target") == Local.Name) and HumanoidRootPart and not Debounce then
  129. local timeToReachTarget = calculateProjectileTime(Ball.Position, HumanoidRootPart.Position, Ball.Velocity)
  130. local distanceToTarget = calculateDistance(Ball.Position, HumanoidRootPart.Position)
  131. local canParry = canObjectParry(Ball.Position, HumanoidRootPart.Position, Ball.Velocity, HumanoidRootPart.Velocity)
  132.  
  133. warn(timeToReachTarget, "Distance:", canParry)
  134. if canParry then
  135. Parry()
  136. LastTime = nil
  137. Debounce = true
  138. local Signal = nil
  139. Signal = RunService.Stepped:Connect(function()
  140. warn("False:", Ball:GetAttribute("target"), os.clock()-Start, Ball, workspace.Dead:FindFirstChild(Local.Name))
  141. if Ball:GetAttribute("target") ~= Local.Name or os.clock()-Start >= 1.25 or not Ball or not workspace.Alive:FindFirstChild(Local.Name) then
  142. warn("Set to false")
  143. Debounce = false
  144. Signal:Disconnect()
  145. end
  146. end)
  147. end
  148. elseif (Ball and Ball:FindFirstChild("zoomies") and Ball:GetAttribute("target") ~= Local.Name) and HumanoidRootPart then
  149. --local HumanoidRootPart = Player.Character and Player.Character:FindFirstChild("HumanoidRootPart")
  150. --local Distance = CalculateDistance(HumanoidRootPart, Delta)
  151. LastPlayer = Player
  152. end
  153. end
  154. Signal[#Signal+1] = RunService.Stepped:Connect(Calculation)
  155. end
  156. end
  157.  
  158. Parry()
  159.  
  160. function Init()
  161. Balls.ChildAdded:Connect(foreach)
  162.  
  163. for i, v in pairs(Balls:GetChildren()) do
  164. foreach(v)
  165. end
  166. end
  167.  
  168. Init()
  169.  
  170. --Local.ChildAdded:Connect(Init)
Add Comment
Please, Sign In to add comment