SpacecowboyHX

sbr

Mar 4th, 2022 (edited)
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. --~boxrum~dojj0~indencito~
  2. --width 4
  3. --height 5
  4. --reach 5.87(6)
  5. --radius max = reach
  6.  
  7. _G.ER = true
  8. local run
  9.  
  10. local p = game.Players.LocalPlayer
  11. local c = p.Character or p.CharacterAdded:Wait()
  12. local new
  13. local hum = c:WaitForChild("Humanoid",5) or c:FindFirstChildOfClass("Humanoid")
  14. local m = p:GetMouse()
  15. local on = false
  16. local lastDeath = tick()
  17.  
  18. new=Instance.new("BodyGyro",c:WaitForChild("HumanoidRootPart"))
  19. new.D=500
  20. new.P=300000
  21. new.MaxTorque=(on==true)and(Vector3.new(0, 400000000, 0))or(Vector3.new(0,0,0))
  22.  
  23. p.CharacterAdded:Connect(function(c2) c=c2;
  24. hum=c2:WaitForChild("Humanoid")or(c2:FindFirstChildOfClass("Humanoid"));
  25. new=Instance.new("BodyGyro",c2:WaitForChild("HumanoidRootPart"));
  26. new.D=500;
  27. new.P=300000;
  28. new.MaxTorque=(on==true)and(Vector3.new(0, 400000000, 0))or(Vector3.new(0,0,0));
  29. end)
  30.  
  31. m.KeyDown:Connect(function(k)
  32. if string.lower(k) == "e" then
  33. on=(on==false)and(true)or(false)
  34. new.MaxTorque=(on==true)and(Vector3.new(0, 400000000, 0))or(Vector3.new(0,0,0))
  35. end
  36. end)
  37.  
  38. repeat wait() until c
  39. if c then
  40. repeat wait() until c.PrimaryPart and hum
  41. print("yes character")
  42. local rp = c.PrimaryPart
  43. local whitelist = "humanoid2"
  44.  
  45. local curT
  46. local lastrando = math.random(1,10)
  47.  
  48. function returnAllTools()
  49. local all = workspace:GetDescendants()
  50. local newT = {}
  51. for i = 1,#all do
  52. if all[i].ClassName == "Tool" then
  53. table.insert(newT,all[i])
  54. end
  55. end
  56. return table.unpack(newT)
  57. end
  58.  
  59. function sword()
  60. local find = c:FindFirstChildOfClass("Tool") or p.Backpack:FindFirstChildOfClass("Tool")
  61. if find and find:FindFirstChildOfClass('Part') and tick()-lastDeath>=.5 then
  62. find.Parent = c
  63. end
  64. return find
  65. end
  66.  
  67. function activate()
  68. local s = sword()
  69. if s then
  70. for i = 1,2 do
  71. s:Activate()
  72. end
  73. end
  74. end
  75.  
  76. if rp then
  77. --rp:SetNetworkOwner(nil)
  78.  
  79. hum.Died:Connect(function()
  80. warn(curT)
  81. end)
  82. function step()
  83. if _G.ER == false then
  84. if run then
  85. run:Disconnect()
  86. end
  87. print("MANUAL OVERRIDE")
  88. end
  89. if on == true and c and new and hum and hum.Health>0 then
  90. rp = c.PrimaryPart
  91. local closest = {nil,math.huge}
  92. local all = workspace:GetDescendants()
  93. for i = 1,#all do
  94.  
  95. local h = all[i]:FindFirstChildOfClass("Humanoid")
  96. if h and h.Health>0 and all[i]~=c and h.Name~=whitelist then
  97.  
  98. local hrp = all[i].PrimaryPart
  99. if hrp and rp then
  100.  
  101. local mag = (hrp.Position-rp.Position).Magnitude
  102. if mag<closest[2] then
  103. --print(hrp.Position, rp.Position)
  104.  
  105. closest[1] = hrp
  106. closest[2] = mag
  107. closest[3] = h
  108. end
  109. end
  110. end
  111. end
  112.  
  113. if closest[1] and closest[3] then
  114.  
  115. local c2 = closest[1].Parent
  116.  
  117. --removed the retrieving of the opponent player object
  118.  
  119. local all2 = c2:GetChildren()
  120. local close = {nil,math.huge}
  121.  
  122. local from = CFrame.new(0,0,0)
  123.  
  124. for i = 1,#all2 do
  125.  
  126. if all2[i].ClassName == "Part" or all2[i].ClassName == "MeshPart" or all2[i].ClassName == "UnionOperation" then
  127.  
  128. local mag2 = ((rp.Position+Vector3.new(0,2.5,0))-all2[i].Position).Magnitude
  129. if mag2 < close[2] then
  130. close[2] = mag2
  131. close[1] = all2[i]
  132. end
  133. end
  134. end
  135.  
  136. if close[1] and closest[1] and rp and sword() then
  137.  
  138. --print(close[2])
  139.  
  140. local shift = 0
  141.  
  142. local from = closest[1].CFrame:ToObjectSpace(rp.CFrame)
  143.  
  144. local zPos = from.Position.Z
  145. local xPos = from.Position.X
  146. --away sword -1
  147. local calc = (xPos>=2 or zPos>0) and 1 or -1
  148. shift = calc
  149. ---print(xPos/closest[2])
  150.  
  151. if c and sword() and close[2]<=(7+(close[1].Velocity.Magnitude)) then
  152. activate()
  153.  
  154. end
  155.  
  156. local _match = string.match(close[1].Name,"%a+%s(Leg)")
  157. if _match~=nil then
  158. --print(close[1].Name)
  159. hum.Jump = true
  160.  
  161. if sword() then
  162. activate()
  163. end
  164.  
  165. hum:MoveTo((CFrame.new(close[1].Position,rp.Position)*CFrame.new(shift,0,-12)).Position)
  166. else
  167. hum:MoveTo((CFrame.new(close[1].Position,rp.Position)*CFrame.new(shift,0,-5.5)).Position)
  168. end
  169.  
  170. local ray = Ray.new(sword().Handle.Position,close[1].Position-sword().Handle.Position)
  171. local hit,pos = workspace:FindPartOnRayWithIgnoreList(ray,{c,returnAllTools()})
  172.  
  173. new.CFrame = CFrame.new(sword().Handle.Position,not hit and close[1].Position or pos)
  174.  
  175. curT = close[1].Name
  176. end
  177. end
  178. else
  179. if hum.Health<=0 then
  180. lastDeath = tick()
  181. end
  182. end
  183. end
  184. run = game:GetService("RunService").RenderStepped:Connect(step)
  185. else
  186. print(rp,hum)
  187. end
  188. end
Add Comment
Please, Sign In to add comment