Advertisement
Webcat70

rbot

Jan 2nd, 2019
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 36.35 KB | None | 0 0
  1. function sandbox(var,func)
  2.     local env = getfenv(func)
  3.     local newenv = setmetatable({},{
  4.         __index = function(self,k)
  5.             if k=="script" then
  6.                 return var
  7.             else
  8.                 return env[k]
  9.             end
  10.         end,
  11.     })
  12.     setfenv(func,newenv)
  13.     return func
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. Model0 = Instance.new("Model")
  18. Part1 = Instance.new("Part")
  19. Motor6D2 = Instance.new("Motor6D")
  20. Part3 = Instance.new("Part")
  21. Motor6D4 = Instance.new("Motor6D")
  22. Motor6D5 = Instance.new("Motor6D")
  23. Motor6D6 = Instance.new("Motor6D")
  24. Motor6D7 = Instance.new("Motor6D")
  25. Motor6D8 = Instance.new("Motor6D")
  26. SpecialMesh9 = Instance.new("SpecialMesh")
  27. Part10 = Instance.new("Part")
  28. SpecialMesh11 = Instance.new("SpecialMesh")
  29. Part12 = Instance.new("Part")
  30. SpecialMesh13 = Instance.new("SpecialMesh")
  31. Part14 = Instance.new("Part")
  32. SpecialMesh15 = Instance.new("SpecialMesh")
  33. Part16 = Instance.new("Part")
  34. SpecialMesh17 = Instance.new("SpecialMesh")
  35. Weld18 = Instance.new("Weld")
  36. Part19 = Instance.new("Part")
  37. SpecialMesh20 = Instance.new("SpecialMesh")
  38. Decal21 = Instance.new("Decal")
  39. Humanoid22 = Instance.new("Humanoid")
  40. Color3Value23 = Instance.new("Color3Value")
  41. Script24 = Instance.new("Script")
  42. Tool25 = Instance.new("Tool")
  43. Part26 = Instance.new("Part")
  44. SpecialMesh27 = Instance.new("SpecialMesh")
  45. Sound28 = Instance.new("Sound")
  46. Sound29 = Instance.new("Sound")
  47. Script30 = Instance.new("Script")
  48. Animation31 = Instance.new("Animation")
  49. Script32 = Instance.new("Script")
  50. Script33 = Instance.new("Script")
  51. Sound34 = Instance.new("Sound")
  52. Sound35 = Instance.new("Sound")
  53. Script36 = Instance.new("Script")
  54. Model37 = Instance.new("Model")
  55. Script38 = Instance.new("Script")
  56. Backpack39 = Instance.new("Backpack")
  57. Script40 = Instance.new("Script")
  58. BindableEvent41 = Instance.new("BindableEvent")
  59. Script42 = Instance.new("Script")
  60. ObjectValue43 = Instance.new("ObjectValue")
  61. Script44 = Instance.new("Script")
  62. AnimationController45 = Instance.new("AnimationController")
  63. Script46 = Instance.new("Script")
  64. Model0.Name = "Bot"
  65. Model0.Parent = mas
  66. Part1.Name = "HumanoidRootPart"
  67. Part1.Parent = Model0
  68. Part1.CFrame = CFrame.new(88.9357452, 2.99999905, -28.5324383, -0.325966269, 4.92454182e-22, -0.945381224, -1.82455399e-22, 0.999999523, 5.83815786e-22, 0.945381224, 3.62794076e-22, -0.325966269)
  69. Part1.Orientation = Vector3.new(0, -109.019997, 0)
  70. Part1.Position = Vector3.new(88.9357452, 2.99999905, -28.5324383)
  71. Part1.Rotation = Vector3.new(-180, -70.9799957, -180)
  72. Part1.Color = Color3.new(0.156863, 0.498039, 0.278431)
  73. Part1.Transparency = 1
  74. Part1.Size = Vector3.new(2, 2, 1)
  75. Part1.BottomSurface = Enum.SurfaceType.Smooth
  76. Part1.BrickColor = BrickColor.new("Dark green")
  77. Part1.Material = Enum.Material.SmoothPlastic
  78. Part1.TopSurface = Enum.SurfaceType.Smooth
  79. Part1.brickColor = BrickColor.new("Dark green")
  80. Part1.FormFactor = Enum.FormFactor.Symmetric
  81. Part1.formFactor = Enum.FormFactor.Symmetric
  82. Motor6D2.Name = "Root Hip"
  83. Motor6D2.Parent = Part1
  84. Motor6D2.MaxVelocity = 0.10000000149012
  85. Motor6D2.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  86. Motor6D2.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  87. Motor6D2.Part0 = Part1
  88. Motor6D2.Part1 = Part3
  89. Motor6D2.part1 = Part3
  90. Part3.Name = "Torso"
  91. Part3.Parent = Model0
  92. Part3.CFrame = CFrame.new(88.9357452, 2.99999905, -28.5324383, -0.325966269, 4.92454182e-22, -0.945381224, -1.82455399e-22, 0.999999523, 5.83815786e-22, 0.945381224, 3.62794076e-22, -0.325966269)
  93. Part3.Orientation = Vector3.new(0, -109.019997, 0)
  94. Part3.Position = Vector3.new(88.9357452, 2.99999905, -28.5324383)
  95. Part3.Rotation = Vector3.new(-180, -70.9799957, -180)
  96. Part3.Color = Color3.new(0.898039, 0.894118, 0.87451)
  97. Part3.Size = Vector3.new(2, 2, 1)
  98. Part3.BottomSurface = Enum.SurfaceType.Smooth
  99. Part3.BrickColor = BrickColor.new("Light stone grey")
  100. Part3.Material = Enum.Material.DiamondPlate
  101. Part3.TopSurface = Enum.SurfaceType.Smooth
  102. Part3.brickColor = BrickColor.new("Light stone grey")
  103. Part3.FormFactor = Enum.FormFactor.Symmetric
  104. Part3.formFactor = Enum.FormFactor.Symmetric
  105. Motor6D4.Name = "Left Hip"
  106. Motor6D4.Parent = Part3
  107. Motor6D4.MaxVelocity = 0.10000000149012
  108. Motor6D4.C0 = CFrame.new(-0.5, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  109. Motor6D4.C1 = CFrame.new(0, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  110. Motor6D4.Part0 = Part3
  111. Motor6D4.Part1 = Part10
  112. Motor6D4.part1 = Part10
  113. Motor6D4.DesiredAngle = -0.038174632936716
  114. Motor6D5.Name = "Right Hip"
  115. Motor6D5.Parent = Part3
  116. Motor6D5.MaxVelocity = 0.10000000149012
  117. Motor6D5.C0 = CFrame.new(0.5, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  118. Motor6D5.C1 = CFrame.new(0, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  119. Motor6D5.Part0 = Part3
  120. Motor6D5.Part1 = Part12
  121. Motor6D5.part1 = Part12
  122. Motor6D5.DesiredAngle = -0.038174632936716
  123. Motor6D6.Name = "Left Shoulder"
  124. Motor6D6.Parent = Part3
  125. Motor6D6.MaxVelocity = 0.15000000596046
  126. Motor6D6.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  127. Motor6D6.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  128. Motor6D6.Part0 = Part3
  129. Motor6D6.Part1 = Part14
  130. Motor6D6.part1 = Part14
  131. Motor6D6.DesiredAngle = 0.038174632936716
  132. Motor6D7.Name = "Right Shoulder"
  133. Motor6D7.Parent = Part3
  134. Motor6D7.MaxVelocity = 0.75
  135. Motor6D7.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  136. Motor6D7.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  137. Motor6D7.Part0 = Part3
  138. Motor6D7.Part1 = Part16
  139. Motor6D7.part1 = Part16
  140. Motor6D7.DesiredAngle = 1.5700000524521
  141. Motor6D8.Name = "Neck"
  142. Motor6D8.Parent = Part3
  143. Motor6D8.MaxVelocity = 0.10000000149012
  144. Motor6D8.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  145. Motor6D8.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  146. Motor6D8.Part0 = Part3
  147. Motor6D8.Part1 = Part19
  148. Motor6D8.part1 = Part19
  149. SpecialMesh9.Parent = Part3
  150. SpecialMesh9.MeshId = "rbxasset://fonts/torso.mesh"
  151. SpecialMesh9.MeshType = Enum.MeshType.FileMesh
  152. Part10.Name = "Left Leg"
  153. Part10.Parent = Model0
  154. Part10.CFrame = CFrame.new(89.098732, 1.00000012, -29.0051289, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
  155. Part10.Orientation = Vector3.new(0, -109.019997, 0)
  156. Part10.Position = Vector3.new(89.098732, 1.00000012, -29.0051289)
  157. Part10.Rotation = Vector3.new(-180, -70.9799957, -180)
  158. Part10.Color = Color3.new(0.156863, 0.498039, 0.278431)
  159. Part10.Size = Vector3.new(1, 2, 1)
  160. Part10.BottomSurface = Enum.SurfaceType.Smooth
  161. Part10.BrickColor = BrickColor.new("Dark green")
  162. Part10.CanCollide = false
  163. Part10.Material = Enum.Material.DiamondPlate
  164. Part10.TopSurface = Enum.SurfaceType.Smooth
  165. Part10.brickColor = BrickColor.new("Dark green")
  166. Part10.FormFactor = Enum.FormFactor.Symmetric
  167. Part10.formFactor = Enum.FormFactor.Symmetric
  168. SpecialMesh11.Parent = Part10
  169. SpecialMesh11.MeshId = "rbxasset://fonts/leftleg.mesh"
  170. SpecialMesh11.MeshType = Enum.MeshType.FileMesh
  171. Part12.Name = "Right Leg"
  172. Part12.Parent = Model0
  173. Part12.CFrame = CFrame.new(88.7727585, 1.00000012, -28.0597477, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
  174. Part12.Orientation = Vector3.new(0, -109.019997, 0)
  175. Part12.Position = Vector3.new(88.7727585, 1.00000012, -28.0597477)
  176. Part12.Rotation = Vector3.new(-180, -70.9799957, -180)
  177. Part12.Color = Color3.new(0.156863, 0.498039, 0.278431)
  178. Part12.Size = Vector3.new(1, 2, 1)
  179. Part12.BottomSurface = Enum.SurfaceType.Smooth
  180. Part12.BrickColor = BrickColor.new("Dark green")
  181. Part12.CanCollide = false
  182. Part12.Material = Enum.Material.DiamondPlate
  183. Part12.TopSurface = Enum.SurfaceType.Smooth
  184. Part12.brickColor = BrickColor.new("Dark green")
  185. Part12.FormFactor = Enum.FormFactor.Symmetric
  186. Part12.formFactor = Enum.FormFactor.Symmetric
  187. SpecialMesh13.Parent = Part12
  188. SpecialMesh13.MeshId = "rbxasset://fonts/leftleg.mesh"
  189. SpecialMesh13.MeshType = Enum.MeshType.FileMesh
  190. Part14.Name = "Left Arm"
  191. Part14.Parent = Model0
  192. Part14.CFrame = CFrame.new(89.4246979, 2.99999905, -29.95051, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
  193. Part14.Orientation = Vector3.new(0, -109.019997, 0)
  194. Part14.Position = Vector3.new(89.4246979, 2.99999905, -29.95051)
  195. Part14.Rotation = Vector3.new(-180, -70.9799957, -180)
  196. Part14.Color = Color3.new(0.960784, 0.803922, 0.188235)
  197. Part14.Size = Vector3.new(1, 2, 1)
  198. Part14.BottomSurface = Enum.SurfaceType.Smooth
  199. Part14.BrickColor = BrickColor.new("Bright yellow")
  200. Part14.CanCollide = false
  201. Part14.Material = Enum.Material.DiamondPlate
  202. Part14.TopSurface = Enum.SurfaceType.Smooth
  203. Part14.brickColor = BrickColor.new("Bright yellow")
  204. Part14.FormFactor = Enum.FormFactor.Symmetric
  205. Part14.formFactor = Enum.FormFactor.Symmetric
  206. SpecialMesh15.Parent = Part14
  207. SpecialMesh15.MeshId = "rbxasset://fonts/leftleg.mesh"
  208. SpecialMesh15.MeshType = Enum.MeshType.FileMesh
  209. Part16.Name = "Right Arm"
  210. Part16.Parent = Model0
  211. Part16.CFrame = CFrame.new(88.4467926, 2.99999905, -27.1143665, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
  212. Part16.Orientation = Vector3.new(0, -109.019997, 0)
  213. Part16.Position = Vector3.new(88.4467926, 2.99999905, -27.1143665)
  214. Part16.Rotation = Vector3.new(-180, -70.9799957, -180)
  215. Part16.Color = Color3.new(0.960784, 0.803922, 0.188235)
  216. Part16.Size = Vector3.new(1, 2, 1)
  217. Part16.BottomSurface = Enum.SurfaceType.Smooth
  218. Part16.BrickColor = BrickColor.new("Bright yellow")
  219. Part16.CanCollide = false
  220. Part16.Material = Enum.Material.DiamondPlate
  221. Part16.TopSurface = Enum.SurfaceType.Smooth
  222. Part16.brickColor = BrickColor.new("Bright yellow")
  223. Part16.FormFactor = Enum.FormFactor.Symmetric
  224. Part16.formFactor = Enum.FormFactor.Symmetric
  225. SpecialMesh17.Parent = Part16
  226. SpecialMesh17.MeshId = "rbxasset://fonts/leftleg.mesh"
  227. SpecialMesh17.MeshType = Enum.MeshType.FileMesh
  228. Weld18.Name = "RightGrip"
  229. Weld18.Parent = Part16
  230. Weld18.C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
  231. Weld18.C1 = CFrame.new(0.0500000007, -0.600000024, -1, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  232. Weld18.Part0 = Part16
  233. Weld18.Part1 = Part26
  234. Weld18.part1 = Part26
  235. Part19.Name = "Head"
  236. Part19.Parent = Model0
  237. Part19.CFrame = CFrame.new(88.9357452, 4.49999809, -28.5324383, -0.325966269, 4.92454182e-22, -0.945381224, -1.82455399e-22, 0.999999523, 5.83815786e-22, 0.945381224, 3.62794076e-22, -0.325966269)
  238. Part19.Orientation = Vector3.new(0, -109.019997, 0)
  239. Part19.Position = Vector3.new(88.9357452, 4.49999809, -28.5324383)
  240. Part19.Rotation = Vector3.new(-180, -70.9799957, -180)
  241. Part19.Color = Color3.new(0.960784, 0.803922, 0.188235)
  242. Part19.Size = Vector3.new(2, 1, 1)
  243. Part19.BottomSurface = Enum.SurfaceType.Smooth
  244. Part19.BrickColor = BrickColor.new("Bright yellow")
  245. Part19.Material = Enum.Material.DiamondPlate
  246. Part19.TopSurface = Enum.SurfaceType.Smooth
  247. Part19.brickColor = BrickColor.new("Bright yellow")
  248. Part19.FormFactor = Enum.FormFactor.Symmetric
  249. Part19.formFactor = Enum.FormFactor.Symmetric
  250. SpecialMesh20.Parent = Part19
  251. SpecialMesh20.Scale = Vector3.new(1.25, 1.25, 1.25)
  252. Decal21.Name = "Face"
  253. Decal21.Parent = Part19
  254. Decal21.Texture = "rbxasset://textures/face.png"
  255. Humanoid22.Parent = Model0
  256. Humanoid22.LeftLeg = Part10
  257. Humanoid22.NameOcclusion = Enum.NameOcclusion.NoOcclusion
  258. Humanoid22.RightLeg = Part12
  259. Humanoid22.Torso = Part1
  260. Color3Value23.Name = "Team"
  261. Color3Value23.Parent = Humanoid22
  262. Color3Value23.Value = Color3.new(0.156863, 0.498039, 0.278431)
  263. Script24.Name = "Sound"
  264. Script24.Parent = Model0
  265. table.insert(cors,sandbox(Script24,function()
  266. wait(0.5)
  267.  
  268. function waitForChild(parent, childName)
  269.     local child = parent:findFirstChild(childName)
  270.     if child then return child end
  271.     while true do
  272.         child = parent.ChildAdded:wait()
  273.         if child.Name==childName then return child end
  274.     end
  275. end
  276.  
  277. function newSound(id)
  278.     local sound = Instance.new("Sound")
  279.     sound.SoundId = id
  280.     sound.archivable = false
  281.     sound.Parent = script.Parent.Head
  282.     return sound
  283. end
  284.  
  285.  
  286. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  287. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  288. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  289. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  290. local sJumping = newSound("rbxasset://sounds/button.wav")
  291. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  292. sRunning.Looped = true
  293.  
  294. local Figure = script.Parent
  295. local Head = waitForChild(Figure, "Head")
  296. local Humanoid = waitForChild(Figure, "Humanoid")
  297.  
  298. function onDied()
  299.     sDied:Play()
  300. end
  301.  
  302. function onState(state, sound)
  303.     if state then
  304.         sound:Play()
  305.     else
  306.         sound:Pause()
  307.     end
  308. end
  309.  
  310. function onRunning(speed)
  311.     if speed>1 then
  312.         sRunning:Play()
  313.     else
  314.         sRunning:Pause()
  315.     end
  316. end
  317.  
  318.  
  319. Humanoid.Died:connect(onDied)
  320. Humanoid.Running:connect(onRunning)
  321. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  322. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  323. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  324. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  325.  
  326. end))
  327. Tool25.Name = "RocketLauncher"
  328. Tool25.Parent = Model0
  329. Tool25.TextureId = "http://www.roblox.com/asset/?id=94689922"
  330. Tool25.CanBeDropped = false
  331. Tool25.Grip = CFrame.new(0.0500000007, -0.600000024, -1, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  332. Tool25.GripPos = Vector3.new(0.0500000007, -0.600000024, -1)
  333. Tool25.ToolTip = "Rocket Launcher"
  334. Part26.Name = "Handle"
  335. Part26.Parent = Tool25
  336. Part26.CFrame = CFrame.new(89.0303192, 2.99999905, -26.9660549, -0.325966269, 0.945381224, 4.92454132e-22, -1.82455399e-22, -5.83815786e-22, 0.999999404, 0.945381224, 0.325966269, 3.62794025e-22)
  337. Part26.Orientation = Vector3.new(-89.9399948, 53.6199989, -162.639999)
  338. Part26.Position = Vector3.new(89.0303192, 2.99999905, -26.9660549)
  339. Part26.Rotation = Vector3.new(-90, 0, -109.019997)
  340. Part26.Color = Color3.new(0.388235, 0.372549, 0.384314)
  341. Part26.Size = Vector3.new(0.839999974, 1.14999998, 3.55000019)
  342. Part26.BottomSurface = Enum.SurfaceType.Smooth
  343. Part26.BrickColor = BrickColor.new("Dark stone grey")
  344. Part26.CanCollide = false
  345. Part26.Locked = true
  346. Part26.TopSurface = Enum.SurfaceType.Smooth
  347. Part26.brickColor = BrickColor.new("Dark stone grey")
  348. Part26.FormFactor = Enum.FormFactor.Custom
  349. Part26.formFactor = Enum.FormFactor.Custom
  350. SpecialMesh27.Parent = Part26
  351. SpecialMesh27.MeshId = "http://www.roblox.com/asset/?id=94690054"
  352. SpecialMesh27.TextureId = "http://www.roblox.com/asset/?id=94689966"
  353. SpecialMesh27.MeshType = Enum.MeshType.FileMesh
  354. Sound28.Name = "ReloadSound"
  355. Sound28.Parent = Part26
  356. Sound28.SoundId = "http://www.roblox.com/Asset?ID=94132726"
  357. Sound28.Volume = 1
  358. Sound29.Name = "Equip"
  359. Sound29.Parent = Part26
  360. Sound29.Pitch = 1.3300000429153
  361. Sound29.PlaybackSpeed = 1.3300000429153
  362. Sound29.SoundId = "http://www.roblox.com/Asset?ID=97103817"
  363. Script30.Name = "Animation"
  364. Script30.Parent = Tool25
  365. table.insert(cors,sandbox(Script30,function()
  366. local Tool = script.Parent
  367. local Char = Tool.Parent
  368. local Animator = Char:findFirstChild("AnimationController") or Instance.new("AnimationController",Char)
  369. local FireAndReloadAnimation = script:WaitForChild('FireAndReload')
  370. local FireAndReloadTrack = Animator:LoadAnimation(FireAndReloadAnimation)
  371.  
  372. local function OnChanged(property)
  373.     if property == 'Enabled' and Tool.Enabled == false then
  374.         -- Play fire and reload animation
  375.         if FireAndReloadTrack then
  376.             FireAndReloadTrack:Play()
  377.         end
  378.     end
  379. end
  380.  
  381. Tool.Changed:connect(OnChanged)
  382. end))
  383. Animation31.Name = "FireAndReload"
  384. Animation31.Parent = Script30
  385. Animation31.AnimationId = "http://www.roblox.com/Asset?ID=94771598"
  386. Script32.Name = "VisualizeReload"
  387. Script32.Parent = Tool25
  388. table.insert(cors,sandbox(Script32,function()
  389. local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=94690081'
  390. local ROCKET_MESH_SCALE = Vector3.new(1, 1, 1)
  391.  
  392. local ROCKET_SHOW_TIME = 1 -- Seconds after animation begins to show the rocket
  393. local ROCKET_HIDE_TIME = 2.15 -- Seconds after animation begins to hide the rocket
  394.  
  395. local Tool = script.Parent
  396. local ToolHandle = Tool.Handle
  397.  
  398. local MyModel = Tool.Parent
  399. local ReloadRocket = Instance.new('Part')
  400. ReloadRocket.Name = "Ammo"
  401. ReloadRocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
  402. ReloadRocket.Size = Vector3.new() -- As small as possible
  403.  
  404. local mesh = Instance.new('SpecialMesh', ReloadRocket)
  405. mesh.MeshId = ROCKET_MESH_ID
  406. mesh.Scale = ROCKET_MESH_SCALE
  407. mesh.TextureId = ToolHandle.Mesh.TextureId
  408.  
  409. local function OnChanged(property)
  410.     if property == 'Enabled' and Tool.Enabled == false then
  411.         -- Show the next rocket going into the launcher
  412.         StillEquipped = true
  413.         wait(ROCKET_SHOW_TIME)
  414.         local torso = MyModel:FindFirstChild('Torso')
  415.         if torso and torso:FindFirstChild('Left Shoulder') then
  416.             local leftArm = MyModel:FindFirstChild('Left Arm')
  417.             if leftArm then
  418.                 local weld = ReloadRocket:FindFirstChild('Weld')
  419.                 if not weld then
  420.                     weld = Instance.new('Weld')
  421.                     weld.Part0 = leftArm
  422.                     weld.Part1 = ReloadRocket
  423.                     weld.C1 = CFrame.new(Vector3.new(0, 1, 0))
  424.                     weld.Parent = ReloadRocket
  425.                 end
  426.                 ReloadRocket.Parent = MyModel
  427.             end
  428.             wait(ROCKET_HIDE_TIME - ROCKET_SHOW_TIME)
  429.             if ReloadRocket.Parent == MyModel then
  430.                 ReloadRocket.Parent = nil
  431.             end
  432.         end
  433.     end
  434. end
  435.  
  436. Tool.Changed:connect(OnChanged)
  437. end))
  438. Script33.Name = "Launcher"
  439. Script33.Parent = Tool25
  440. table.insert(cors,sandbox(Script33,function()
  441. -----------------
  442. --| Constants |--
  443. -----------------
  444.  
  445. local COOLDOWN = 3.0 -- Seconds until tool can be used again
  446.  
  447. -- RocketPropulsion Fields
  448. local TARGET_RADIUS = 5
  449. local MAX_SPEED = 60
  450. local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
  451. local MAX_THRUST = 50000
  452. local THRUST_P = 500
  453. local THRUST_D = 50000
  454.  
  455. local TARGET_OVERSHOOT_DISTANCE = 10000000
  456.  
  457. -- How far away from the handle does the user have to click for
  458. -- the rocket to allow killing of the user themself.
  459. local CLOSE_SHOT_DISTANCE = 10
  460.  
  461. -- Rocket Fields
  462. local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=94690081'
  463. local ROCKET_MESH_SCALE = Vector3.new(2.5, 2.5, 2)
  464. local ROCKET_PART_SIZE = Vector3.new(1, 1, 4)
  465.  
  466. --------------------
  467. --| WaitForChild |--
  468. --------------------
  469.  
  470. -- Waits for parent.child to exist, then returns it
  471. local function WaitForChild(parent, childName)
  472.     assert(parent, "ERROR: WaitForChild: parent is nil")
  473.     while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  474.     return parent[childName]
  475. end
  476.  
  477. -----------------
  478. --| Variables |--
  479. -----------------
  480.  
  481. local DebrisService = Game:GetService('Debris')
  482. local PlayersService = Game:GetService('Players')
  483.  
  484. local Tool = script.Parent
  485. local ToolHandle = Tool.Handle
  486.  
  487. local RocketScript = WaitForChild(script, 'Rocket')
  488.  
  489. local SwooshSound = WaitForChild(script, 'Swoosh')
  490. local BoomSound = WaitForChild(script, 'Boom')
  491. local ReloadSound = WaitForChild(ToolHandle, 'ReloadSound')
  492. local EquipSound = WaitForChild(ToolHandle, 'Equip')
  493.  
  494. local MyModel = nil
  495.  
  496. local BaseRocket = nil
  497. local RocketClone = nil
  498.  
  499. -----------------
  500. --| Functions |--
  501. -----------------
  502.  
  503. local function MakeBaseRocket()
  504.     -- Set up the rocket part
  505.     local rocket = Instance.new('Part')
  506.     rocket.Name = 'Rocket'
  507.     rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
  508.     rocket.Size = ROCKET_PART_SIZE
  509.     rocket.CanCollide = false
  510.     rocket.BottomSurface = Enum.SurfaceType.Smooth
  511.     rocket.TopSurface = Enum.SurfaceType.Smooth
  512.  
  513.     -- Add the mesh
  514.     local mesh = Instance.new('SpecialMesh', rocket)
  515.     mesh.MeshId = ROCKET_MESH_ID
  516.     mesh.Scale = ROCKET_MESH_SCALE
  517.     mesh.TextureId = ToolHandle.Mesh.TextureId
  518.  
  519.     -- Add fire
  520.     local fire = Instance.new('Fire', rocket)
  521.     fire.Heat = 5
  522.     fire.Size = 2
  523.  
  524.     -- Add the propulsion
  525.     local rocketPropulsion = Instance.new('RocketPropulsion', rocket)
  526.     rocketPropulsion.CartoonFactor = 1
  527.     rocketPropulsion.TargetRadius = TARGET_RADIUS
  528.     rocketPropulsion.MaxSpeed = MAX_SPEED
  529.     rocketPropulsion.MaxTorque = MAX_TORQUE
  530.     rocketPropulsion.MaxThrust = MAX_THRUST
  531.     rocketPropulsion.ThrustP = THRUST_P
  532.     rocketPropulsion.ThrustD = THRUST_D
  533.  
  534.     -- Clone the sounds
  535.     local swooshSoundClone = SwooshSound:Clone()
  536.     swooshSoundClone.Parent = rocket
  537.     local boomSoundClone = BoomSound:Clone()
  538.     boomSoundClone.PlayOnRemove = true
  539.     boomSoundClone.Parent = rocket
  540.  
  541.     -- Attach creator tags
  542.     local creatorTag = Instance.new('ObjectValue', rocket)
  543.     creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
  544.     creatorTag.Value = MyModel
  545.     local nameTag = Instance.new('StringValue', creatorTag)
  546.     nameTag.Name = 'weaponName'
  547.     nameTag.Value = Tool.Name
  548.     local iconTag = Instance.new('StringValue', creatorTag)
  549.     iconTag.Name = 'weaponIcon'
  550.     iconTag.Value = Tool.TextureId
  551.    
  552.     -- The "close shot" tag. True if the rocket should be able to kill the
  553.     -- creator.
  554.     local closeShot = Instance.new('BoolValue', rocket)
  555.     closeShot.Name = 'closeShot'
  556.     closeShot.Value = false
  557.  
  558.     -- Finally, clone the rocket script and enable it
  559.     local rocketScriptClone = RocketScript:Clone()
  560.     rocketScriptClone.Parent = rocket
  561.     rocketScriptClone.Disabled = false
  562.  
  563.     return rocket
  564. end
  565.  
  566. MyModel = Tool.Parent
  567. BaseRocket = MakeBaseRocket()
  568. RocketClone = BaseRocket:Clone()
  569.  
  570. local function OnActivated(targetPosition)
  571.     if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
  572.         Tool.Enabled = false
  573.        
  574.         -- Maybe set the "closeShot" flag
  575.         if (targetPosition - ToolHandle.Position).magnitude < CLOSE_SHOT_DISTANCE then
  576.             RocketClone.closeShot.Value = true
  577.         end
  578.  
  579.         -- Position the rocket clone
  580.         local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.Z / 2))
  581.         RocketClone.CFrame = CFrame.new(spawnPosition, targetPosition) --NOTE: This must be done before assigning Parent
  582.         DebrisService:AddItem(RocketClone, 30)
  583.         RocketClone.Parent = Workspace
  584.  
  585.         -- Assign target and launch!
  586.         local rocketPropulsion = RocketClone:FindFirstChild('RocketPropulsion')
  587.         if rocketPropulsion then
  588.             local direction = (targetPosition - RocketClone.Position).unit
  589.             rocketPropulsion.TargetOffset = RocketClone.Position + (direction * TARGET_OVERSHOOT_DISTANCE)
  590.             rocketPropulsion:Fire()
  591.         end
  592.  
  593.         -- Prepare the next rocket to be fired
  594.         RocketClone = BaseRocket:Clone()
  595.  
  596.         ReloadSound:Play()
  597.  
  598.         -- Cooldown
  599.         wait(COOLDOWN)
  600.  
  601.         -- Stop the reloading sound if it hasn't already finished
  602.  
  603.         Tool.Enabled = true
  604.     end
  605. end
  606.  
  607. local AI = MyModel:WaitForChild("AI")
  608. local down = AI:WaitForChild("MouseDown")
  609. down.Event:connect(OnActivated)
  610. end))
  611. Sound34.Name = "Boom"
  612. Sound34.Parent = Script33
  613. Sound34.SoundId = "rbxasset://sounds/collide.wav"
  614. Sound34.Volume = 1
  615. Sound35.Name = "Swoosh"
  616. Sound35.Parent = Script33
  617. Sound35.Looped = true
  618. Sound35.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
  619. Sound35.Volume = 0.69999998807907
  620. Script36.Name = "Rocket"
  621. Script36.Parent = Script33
  622. table.insert(cors,sandbox(Script36,function()
  623. -----------------
  624. --| Constants |--
  625. -----------------
  626.  
  627. local BLAST_RADIUS = 6
  628. --local BLAST_PRESSURE = 750000
  629. local BLAST_PRESSURE = 0
  630.  
  631. local IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} -- Rocket will fly through things named these
  632. --NOTE: Keys must be lowercase, values must evaluate to true
  633.  
  634. --------------------
  635. --| WaitForChild |--
  636. --------------------
  637.  
  638. -- Waits for parent.child to exist, then returns it
  639. local function WaitForChild(parent, childName)
  640.     assert(parent, "ERROR: WaitForChild: parent is nil")
  641.     while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  642.     return parent[childName]
  643. end
  644.  
  645. -----------------
  646. --| Variables |--
  647. -----------------
  648.  
  649. local DebrisService = Game:GetService('Debris')
  650.  
  651. local Rocket = script.Parent
  652.  
  653. local CreatorTag = WaitForChild(Rocket, 'creator')
  654.  
  655. local SwooshSound = WaitForChild(Rocket, 'Swoosh')
  656.  
  657. -----------------
  658. --| Functions |--
  659. -----------------
  660.  
  661. -- Returns the ancestor that contains a Humanoid, if it exists
  662. local function FindCharacterAncestor(subject)
  663.     if subject and subject ~= Workspace then
  664.         local humanoid = subject:FindFirstChild('Humanoid')
  665.         if humanoid then
  666.             return subject, humanoid
  667.         else
  668.             return FindCharacterAncestor(subject.Parent)
  669.         end
  670.     end
  671.     return nil
  672. end
  673.  
  674. local function OnExplosionHit(hitPart)
  675.     if hitPart then
  676.         local _, humanoid = FindCharacterAncestor(hitPart.Parent)
  677.         if humanoid and humanoid.Health > 0 then
  678.             CreatorTag:Clone().Parent=humanoid
  679.             humanoid:TakeDamage(100)
  680.         end
  681.     end
  682. end
  683.  
  684. local function OnTouched(otherPart)
  685.     if Rocket and otherPart then
  686.         -- Fly through anything in the ignore list
  687.         if IGNORE_LIST[string.lower(otherPart.Name)] then
  688.             return
  689.         end
  690.  
  691.         -- Fly through the creator
  692.         local myPlayer = CreatorTag.Value
  693.         if myPlayer and myPlayer:IsAncestorOf(otherPart) then
  694.             return
  695.         end
  696.        
  697.         OnExplosionHit(hitPart)
  698.        
  699.         -- Boom
  700.         local explosion = Instance.new('Explosion')
  701.         explosion.BlastPressure = BLAST_PRESSURE
  702.         explosion.BlastRadius = BLAST_RADIUS
  703.         explosion.Position = Rocket.Position
  704.         explosion.Hit:connect(OnExplosionHit)
  705.         explosion.Parent = Workspace
  706.  
  707.         -- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
  708.         script.Parent = explosion
  709.         CreatorTag.Parent = script
  710.         Rocket:Destroy()
  711.     end
  712. end
  713.  
  714. --------------------
  715. --| Script Logic |--
  716. --------------------
  717.  
  718. SwooshSound:Play()
  719.  
  720. Rocket.Touched:connect(OnTouched)
  721.  
  722. -- Manually call OnTouched for parts the rocket might have spawned inside of
  723. --TODO: Remove when Touched correctly fires for parts spawned within other parts
  724. local partClone = Rocket:Clone()
  725. partClone:ClearAllChildren()
  726. partClone.Transparency = 1
  727. --partClone.Anchored = true --NOTE: DOES NOT WORK if part is anchored!
  728. DebrisService:AddItem(partClone, 0.1)
  729. partClone.Parent = Workspace
  730. partClone.Touched:connect(OnTouched)
  731.  
  732. end))
  733. Script36.Disabled = true
  734. Model37.Name = "DebugPathDraw"
  735. Model37.Parent = Model0
  736. Script38.Name = "Animate"
  737. Script38.Parent = Model0
  738. table.insert(cors,sandbox(Script38,function()
  739. function waitForChild(parent, childName)
  740.     local child = parent:findFirstChild(childName)
  741.     if child then return child end
  742.     while true do
  743.         child = parent.ChildAdded:wait()
  744.         if child.Name==childName then return child end
  745.     end
  746. end
  747.  
  748. -- ANIMATION
  749.  
  750. -- declarations
  751.  
  752. local Figure = script.Parent
  753. local Torso = waitForChild(Figure, "Torso")
  754. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  755. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  756. local RightHip = waitForChild(Torso, "Right Hip")
  757. local LeftHip = waitForChild(Torso, "Left Hip")
  758. local Neck = waitForChild(Torso, "Neck")
  759. local Humanoid = waitForChild(Figure, "Humanoid")
  760. local pose = "Standing"
  761.  
  762. local toolAnim = "None"
  763. local toolAnimTime = 0
  764.  
  765. local jumpMaxLimbVelocity = 0.75
  766.  
  767. -- functions
  768.  
  769. function onRunning(speed)
  770.     if speed>1 then
  771.         pose = "Running"
  772.     else
  773.         pose = "Standing"
  774.     end
  775. end
  776.  
  777. function onDied()
  778.     pose = "Dead"
  779. end
  780.  
  781. function onJumping()
  782.     pose = "Jumping"
  783. end
  784.  
  785. function onClimbing()
  786.     pose = "Climbing"
  787. end
  788.  
  789. function onGettingUp()
  790.     pose = "GettingUp"
  791. end
  792.  
  793. function onFreeFall()
  794.     pose = "FreeFall"
  795. end
  796.  
  797. function onFallingDown()
  798.     pose = "FallingDown"
  799. end
  800.  
  801. function onSeated()
  802.     pose = "Seated"
  803. end
  804.  
  805. function onPlatformStanding()
  806.     pose = "PlatformStanding"
  807. end
  808.  
  809. function onSwimming(speed)
  810.     if speed>0 then
  811.         pose = "Running"
  812.     else
  813.         pose = "Standing"
  814.     end
  815. end
  816.  
  817. function moveJump()
  818.     RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  819.     LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  820.   RightShoulder:SetDesiredAngle(3.14)
  821.     LeftShoulder:SetDesiredAngle(-3.14)
  822.     RightHip:SetDesiredAngle(0)
  823.     LeftHip:SetDesiredAngle(0)
  824. end
  825.  
  826.  
  827. -- same as jump for now
  828.  
  829. function moveFreeFall()
  830.     RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  831.     LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  832.     RightShoulder:SetDesiredAngle(3.14)
  833.     LeftShoulder:SetDesiredAngle(-3.14)
  834.     RightHip:SetDesiredAngle(0)
  835.     LeftHip:SetDesiredAngle(0)
  836. end
  837.  
  838. function moveSit()
  839.     RightShoulder.MaxVelocity = 0.15
  840.     LeftShoulder.MaxVelocity = 0.15
  841.     RightShoulder:SetDesiredAngle(3.14 /2)
  842.     LeftShoulder:SetDesiredAngle(-3.14 /2)
  843.     RightHip:SetDesiredAngle(3.14 /2)
  844.     LeftHip:SetDesiredAngle(-3.14 /2)
  845. end
  846.  
  847. function getTool() 
  848.     for _, kid in ipairs(Figure:GetChildren()) do
  849.         if kid.className == "Tool" then return kid end
  850.     end
  851.     return nil
  852. end
  853.  
  854. function getToolAnim(tool)
  855.     for _, c in ipairs(tool:GetChildren()) do
  856.         if c.Name == "toolanim" and c.className == "StringValue" then
  857.             return c
  858.         end
  859.     end
  860.     return nil
  861. end
  862.  
  863. function animateTool()
  864.    
  865.     if (toolAnim == "None") then
  866.         RightShoulder:SetDesiredAngle(1.57)
  867.         return
  868.     end
  869.  
  870.     if (toolAnim == "Slash") then
  871.         RightShoulder.MaxVelocity = 0.5
  872.         RightShoulder:SetDesiredAngle(0)
  873.         return
  874.     end
  875.  
  876.     if (toolAnim == "Lunge") then
  877.         RightShoulder.MaxVelocity = 0.5
  878.         LeftShoulder.MaxVelocity = 0.5
  879.         RightHip.MaxVelocity = 0.5
  880.         LeftHip.MaxVelocity = 0.5
  881.         RightShoulder:SetDesiredAngle(1.57)
  882.         LeftShoulder:SetDesiredAngle(1.0)
  883.         RightHip:SetDesiredAngle(1.57)
  884.         LeftHip:SetDesiredAngle(1.0)
  885.         return
  886.     end
  887. end
  888.  
  889. function move(time)
  890.     local amplitude
  891.     local frequency
  892.  
  893.     if (pose == "Jumping") then
  894.         moveJump()
  895.         return
  896.     end
  897.  
  898.     if (pose == "FreeFall") then
  899.         moveFreeFall()
  900.         return
  901.     end
  902.  
  903.     if (pose == "Seated") then
  904.         moveSit()
  905.         return
  906.     end
  907.  
  908.     local climbFudge = 0
  909.    
  910.     if (pose == "Running") then
  911.     if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
  912.             RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  913.         else           
  914.             RightShoulder.MaxVelocity = 0.15
  915.         end
  916.         if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
  917.             LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  918.         else           
  919.             LeftShoulder.MaxVelocity = 0.15
  920.         end
  921.         amplitude = 1
  922.         frequency = 9
  923.     elseif (pose == "Climbing") then
  924.         RightShoulder.MaxVelocity = 0.5
  925.         LeftShoulder.MaxVelocity = 0.5
  926.         amplitude = 1
  927.         frequency = 9
  928.         climbFudge = 3.14
  929.     else
  930.         amplitude = 0.1
  931.         frequency = 1
  932.     end
  933.  
  934.     desiredAngle = amplitude * math.sin(time*frequency)
  935.  
  936.     RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  937.     LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  938.     RightHip:SetDesiredAngle(-desiredAngle)
  939.     LeftHip:SetDesiredAngle(-desiredAngle)
  940.  
  941.  
  942.     local tool = getTool()
  943.  
  944.     if tool then
  945.    
  946.         animStringValueObject = getToolAnim(tool)
  947.  
  948.         if animStringValueObject then
  949.             toolAnim = animStringValueObject.Value
  950.             -- message recieved, delete StringValue
  951.             animStringValueObject.Parent = nil
  952.             toolAnimTime = time + .3
  953.         end
  954.  
  955.         if time > toolAnimTime then
  956.             toolAnimTime = 0
  957.             toolAnim = "None"
  958.         end
  959.  
  960.         animateTool()
  961.  
  962.        
  963.     else
  964.         toolAnim = "None"
  965.         toolAnimTime = 0
  966.     end
  967. end
  968.  
  969.  
  970. -- connect events
  971.  
  972. Humanoid.Died:connect(onDied)
  973. Humanoid.Running:connect(onRunning)
  974. Humanoid.Jumping:connect(onJumping)
  975. Humanoid.Climbing:connect(onClimbing)
  976. Humanoid.GettingUp:connect(onGettingUp)
  977. Humanoid.FreeFalling:connect(onFreeFall)
  978. Humanoid.FallingDown:connect(onFallingDown)
  979. Humanoid.Seated:connect(onSeated)
  980. Humanoid.PlatformStanding:connect(onPlatformStanding)
  981. Humanoid.Swimming:connect(onSwimming)
  982. -- main program
  983.  
  984. local runService = game:service("RunService");
  985.  
  986. while Figure.Parent~=nil do
  987.     local _, time = wait(0.1)
  988.     move(time)
  989. end
  990.  
  991. end))
  992. Backpack39.Name = "AI"
  993. Backpack39.Parent = Model0
  994. Script40.Name = "Pathfinding"
  995. Script40.Parent = Backpack39
  996. table.insert(cors,sandbox(Script40,function()
  997. debugMode = false
  998. targetNPCs = false
  999.  
  1000. --
  1001.  
  1002. h = script.Parent.Parent:WaitForChild("Humanoid")
  1003. pathService = game:GetService("PathfindingService")
  1004. targetV = script.Parent:WaitForChild("Target")
  1005.  
  1006. function closestTargetAndPath()
  1007.     local humanoids = {}
  1008.     if targetNPCs then
  1009.         local function recurse(o)
  1010.             for _,obj in pairs(o:GetChildren()) do
  1011.                 if obj:IsA("Model") then
  1012.                     if obj:findFirstChild("Humanoid") and obj:findFirstChild("Torso") and obj.Humanoid ~= h and obj.Humanoid.Health > 0 and not obj:findFirstChild("ForceField") then
  1013.                         table.insert(humanoids,obj.Humanoid)
  1014.                     end
  1015.                 end
  1016.                 recurse(obj)
  1017.             end
  1018.         end
  1019.         recurse(workspace)
  1020.     else
  1021.         for _,v in pairs(game.Players:GetPlayers()) do
  1022.             if v.Character and v.Character:findFirstChild("HumanoidRootPart") and v.Character:findFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 and not v:findFirstChild("ForceField") then
  1023.                 table.insert(humanoids,v.Character.Humanoid)
  1024.             end
  1025.         end
  1026.     end
  1027.     local closest,path,dist
  1028.     for _,humanoid in pairs(humanoids) do
  1029.         local myPath = pathService:ComputeRawPathAsync(h.Torso.Position,humanoid.Torso.Position,500)
  1030.         if myPath.Status ~= Enum.PathStatus.FailFinishNotEmpty then
  1031.             -- Now that we have a successful path, we need to figure out how far we need to actually travel to reach this point.
  1032.             local myDist = 0
  1033.             local previous = h.Torso.Position
  1034.             for _,point in pairs(myPath:GetPointCoordinates()) do
  1035.                 myDist = myDist + (point-previous).magnitude
  1036.                 previous = point
  1037.             end
  1038.             if not dist or myDist < dist then -- if true, this is the closest path so far.
  1039.                 closest = humanoid
  1040.                 path = myPath
  1041.                 dist = myDist
  1042.             end
  1043.         end
  1044.     end
  1045.     return closest,path
  1046. end
  1047.  
  1048. function goToPos(loc)
  1049.     h:MoveTo(loc)
  1050.     local distance = (loc-h.Torso.Position).magnitude
  1051.     local start = tick()
  1052.     while distance > 4 do
  1053.         if tick()-start > distance/h.WalkSpeed then -- Something may have gone wrong. Just break.
  1054.             break
  1055.         end
  1056.         distance = (loc-h.Torso.Position).magnitude
  1057.         wait()
  1058.     end
  1059. end
  1060.  
  1061. while wait() do
  1062.     local target,path = closestTargetAndPath()
  1063.     local didBreak = false
  1064.     local targetStart
  1065.     if target and h.Torso then
  1066.         targetV.Value = target
  1067.         targetStart = target.Torso.Position
  1068.         roaming = false
  1069.         local previous = h.Torso.Position
  1070.         local points = path:GetPointCoordinates()
  1071.         local s = #points > 1 and 2 or 1
  1072.         for i = s,#points do
  1073.             local point = points[i]
  1074.             if didBreak then
  1075.                 break
  1076.             end
  1077.             if target and target.Torso and target.Health > 0 then
  1078.                 if (target.Torso.Position-targetStart).magnitude < 1.5 then
  1079.                     local pos = previous:lerp(point,.5)
  1080.                     local moveDir = ((pos - h.Torso.Position).unit * 2)
  1081.                     goToPos(previous:lerp(point,.5))
  1082.                     previous = point
  1083.                 end
  1084.             else
  1085.                 didBreak = true
  1086.                 break
  1087.             end
  1088.         end
  1089.     else
  1090.         targetV.Value = nil
  1091.     end
  1092.     if not didBreak and targetStart then
  1093.         goToPos(targetStart)
  1094.     end
  1095. end
  1096. end))
  1097. BindableEvent41.Name = "MouseDown"
  1098. BindableEvent41.Parent = Backpack39
  1099. Script42.Name = "AutoJump"
  1100. Script42.Parent = Backpack39
  1101. table.insert(cors,sandbox(Script42,function()
  1102. local h = script.Parent.Parent:WaitForChild("Humanoid")
  1103.  
  1104. while wait(math.random()/4) do
  1105.     local check1 = game.Workspace:FindPartOnRay(Ray.new(h.Torso.Position-Vector3.new(0,1.5,0), h.Torso.CFrame.lookVector*3), h.Parent)
  1106.     local check2 = game.Workspace:FindPartOnRay(Ray.new(h.Torso.Position+Vector3.new(0,1.5,0), h.Torso.CFrame.lookVector*3), h.Parent)
  1107.     if check1 or check2 then
  1108.         h.Jump = true
  1109.     end
  1110. end
  1111. end))
  1112. ObjectValue43.Name = "Target"
  1113. ObjectValue43.Parent = Backpack39
  1114. Script44.Name = "WeaponFiring"
  1115. Script44.Parent = Backpack39
  1116. table.insert(cors,sandbox(Script44,function()
  1117. local target = script.Parent:WaitForChild("Target")
  1118. local torso = script.Parent.Parent:WaitForChild("Torso")
  1119. local down = script.Parent:WaitForChild("MouseDown")
  1120.  
  1121. function handler(new)
  1122.     if target.Value then
  1123.         while target.Value == new do
  1124.             if target.Value and target.Value.Parent == nil then
  1125.                 target.Value = nil
  1126.                 return
  1127.             end
  1128.             local look = (new.Torso.Position-torso.Position).unit * 300
  1129.             local hit = workspace:FindPartOnRayWithIgnoreList(Ray.new(torso.Position,look),{script.Parent.Parent,new.Parent})
  1130.             if not hit or (new.Torso.Position-torso.Position).magnitude < 10 then
  1131.                 down:Fire(new.Torso.Position)
  1132.             end
  1133.             wait(0.2)
  1134.         end
  1135.     end
  1136. end
  1137.  
  1138. target.Changed:connect(handler)
  1139.  
  1140. if target.Value then
  1141.     handler(target.Value)
  1142. end
  1143. end))
  1144. AnimationController45.Parent = Model0
  1145. Script46.Name = "Respawn"
  1146. Script46.Parent = Model0
  1147. table.insert(cors,sandbox(Script46,function()
  1148. local humanoid = script.Parent:WaitForChild("Humanoid")
  1149. local backup = script.Parent:clone()
  1150.  
  1151. humanoid.Died:connect(function ()
  1152.     wait(5)
  1153.     backup.Parent = workspace
  1154.     if script.Parent then
  1155.         script.Parent:Destroy()
  1156.     end
  1157. end)
  1158.  
  1159.  
  1160.  
  1161. end))
  1162. for i,v in pairs(mas:GetChildren()) do
  1163.     v.Parent = workspace
  1164.     pcall(function() v:MakeJoints() end)
  1165. end
  1166. mas:Destroy()
  1167. for i,v in pairs(cors) do
  1168.     spawn(function()
  1169.         pcall(v)
  1170.     end)
  1171. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement