Advertisement
OofNoob

epic dummy

Mar 28th, 2018
500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.17 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. SpecialMesh2 = Instance.new("SpecialMesh")
  20. Decal3 = Instance.new("Decal")
  21. Part4 = Instance.new("Part")
  22. Decal5 = Instance.new("Decal")
  23. Motor6 = Instance.new("Motor")
  24. Motor7 = Instance.new("Motor")
  25. Motor8 = Instance.new("Motor")
  26. Motor9 = Instance.new("Motor")
  27. Motor10 = Instance.new("Motor")
  28. Part11 = Instance.new("Part")
  29. Part12 = Instance.new("Part")
  30. Part13 = Instance.new("Part")
  31. Part14 = Instance.new("Part")
  32. Humanoid15 = Instance.new("Humanoid")
  33. CFrameValue16 = Instance.new("CFrameValue")
  34. BoolValue17 = Instance.new("BoolValue")
  35. IntValue18 = Instance.new("IntValue")
  36. BoolValue19 = Instance.new("BoolValue")
  37. BrickColorValue20 = Instance.new("BrickColorValue")
  38. BoolValue21 = Instance.new("BoolValue")
  39. BoolValue22 = Instance.new("BoolValue")
  40. BoolValue23 = Instance.new("BoolValue")
  41. Vector3Value24 = Instance.new("Vector3Value")
  42. BoolValue25 = Instance.new("BoolValue")
  43. BoolValue26 = Instance.new("BoolValue")
  44. BodyColors27 = Instance.new("BodyColors")
  45. BoolValue28 = Instance.new("BoolValue")
  46. Script29 = Instance.new("Script")
  47. IntValue30 = Instance.new("IntValue")
  48. IntValue31 = Instance.new("IntValue")
  49. IntValue32 = Instance.new("IntValue")
  50. Model0.Name = "Epic Dummy"
  51. Model0.Parent = mas
  52. Model0.PrimaryPart = Part1
  53. Part1.Name = "Head"
  54. Part1.Parent = Model0
  55. Part1.BrickColor = BrickColor.new("Cool yellow")
  56. Part1.FormFactor = Enum.FormFactor.Symmetric
  57. Part1.Size = Vector3.new(2, 1, 1)
  58. Part1.CFrame = CFrame.new(110.799973, 9.50001907, 30.6000004, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  59. Part1.TopSurface = Enum.SurfaceType.Smooth
  60. Part1.Color = Color3.new(0.992157, 0.917647, 0.552941)
  61. Part1.Position = Vector3.new(110.799973, 9.50001907, 30.6000004)
  62. Part1.Color = Color3.new(0.992157, 0.917647, 0.552941)
  63. SpecialMesh2.Parent = Part1
  64. SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
  65. SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
  66. Decal3.Name = "face"
  67. Decal3.Parent = Part1
  68. Decal3.Texture = "rbxassetid://42070872"
  69. Part4.Name = "Torso"
  70. Part4.Parent = Model0
  71. Part4.BrickColor = BrickColor.new("Dark green")
  72. Part4.FormFactor = Enum.FormFactor.Symmetric
  73. Part4.Size = Vector3.new(2, 2, 1)
  74. Part4.CFrame = CFrame.new(110.799973, 8.00001907, 30.6000004, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  75. Part4.LeftSurface = Enum.SurfaceType.Weld
  76. Part4.RightSurface = Enum.SurfaceType.Weld
  77. Part4.Color = Color3.new(0.156863, 0.498039, 0.278431)
  78. Part4.Position = Vector3.new(110.799973, 8.00001907, 30.6000004)
  79. Part4.Color = Color3.new(0.156863, 0.498039, 0.278431)
  80. Decal5.Name = "roblox"
  81. Decal5.Parent = Part4
  82. Motor6.Name = "Right Shoulder"
  83. Motor6.Parent = Part4
  84. Motor6.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  85. Motor6.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  86. Motor6.Part0 = Part4
  87. Motor6.Part1 = Part12
  88. Motor6.MaxVelocity = 0.15000000596046
  89. Motor7.Name = "Left Shoulder"
  90. Motor7.Parent = Part4
  91. Motor7.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  92. Motor7.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  93. Motor7.Part0 = Part4
  94. Motor7.Part1 = Part11
  95. Motor7.MaxVelocity = 0.15000000596046
  96. Motor8.Name = "Right Hip"
  97. Motor8.Parent = Part4
  98. Motor8.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  99. Motor8.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  100. Motor8.Part0 = Part4
  101. Motor8.Part1 = Part14
  102. Motor8.MaxVelocity = 0.10000000149012
  103. Motor9.Name = "Left Hip"
  104. Motor9.Parent = Part4
  105. Motor9.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  106. Motor9.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  107. Motor9.Part0 = Part4
  108. Motor9.Part1 = Part13
  109. Motor9.MaxVelocity = 0.10000000149012
  110. Motor10.Name = "Neck"
  111. Motor10.Parent = Part4
  112. Motor10.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  113. Motor10.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  114. Motor10.Part0 = Part4
  115. Motor10.Part1 = Part1
  116. Motor10.MaxVelocity = 0.10000000149012
  117. Part11.Name = "Left Arm"
  118. Part11.Parent = Model0
  119. Part11.BrickColor = BrickColor.new("Cool yellow")
  120. Part11.CanCollide = false
  121. Part11.FormFactor = Enum.FormFactor.Symmetric
  122. Part11.Size = Vector3.new(1, 2, 1)
  123. Part11.CFrame = CFrame.new(109.299973, 8.00001907, 30.6000004, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  124. Part11.Color = Color3.new(0.992157, 0.917647, 0.552941)
  125. Part11.Position = Vector3.new(109.299973, 8.00001907, 30.6000004)
  126. Part11.Color = Color3.new(0.992157, 0.917647, 0.552941)
  127. Part12.Name = "Right Arm"
  128. Part12.Parent = Model0
  129. Part12.BrickColor = BrickColor.new("Cool yellow")
  130. Part12.CanCollide = false
  131. Part12.FormFactor = Enum.FormFactor.Symmetric
  132. Part12.Size = Vector3.new(1, 2, 1)
  133. Part12.CFrame = CFrame.new(112.299973, 8.00001907, 30.6000004, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  134. Part12.Color = Color3.new(0.992157, 0.917647, 0.552941)
  135. Part12.Position = Vector3.new(112.299973, 8.00001907, 30.6000004)
  136. Part12.Color = Color3.new(0.992157, 0.917647, 0.552941)
  137. Part13.Name = "Left Leg"
  138. Part13.Parent = Model0
  139. Part13.BrickColor = BrickColor.new("Bright blue")
  140. Part13.CanCollide = false
  141. Part13.FormFactor = Enum.FormFactor.Symmetric
  142. Part13.Size = Vector3.new(1, 2, 1)
  143. Part13.CFrame = CFrame.new(110.299973, 6.00001907, 30.6000004, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  144. Part13.BottomSurface = Enum.SurfaceType.Smooth
  145. Part13.TopSurface = Enum.SurfaceType.Inlet
  146. Part13.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  147. Part13.Position = Vector3.new(110.299973, 6.00001907, 30.6000004)
  148. Part13.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  149. Part14.Name = "Right Leg"
  150. Part14.Parent = Model0
  151. Part14.BrickColor = BrickColor.new("Bright blue")
  152. Part14.CanCollide = false
  153. Part14.FormFactor = Enum.FormFactor.Symmetric
  154. Part14.Size = Vector3.new(1, 2, 1)
  155. Part14.CFrame = CFrame.new(111.299973, 6.00001907, 30.6000004, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  156. Part14.BottomSurface = Enum.SurfaceType.Smooth
  157. Part14.TopSurface = Enum.SurfaceType.Inlet
  158. Part14.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  159. Part14.Position = Vector3.new(111.299973, 6.00001907, 30.6000004)
  160. Part14.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  161. Humanoid15.Parent = Model0
  162. Humanoid15.NameOcclusion = Enum.NameOcclusion.NoOcclusion
  163. Humanoid15.RightLeg = Part14
  164. Humanoid15.LeftLeg = Part13
  165. Humanoid15.Torso = Part4
  166. CFrameValue16.Name = "IsAPlayer"
  167. CFrameValue16.Parent = Model0
  168. BoolValue17.Name = "Respawn"
  169. BoolValue17.Parent = Model0
  170. BoolValue17.Value = true
  171. IntValue18.Name = "Force_Weapon"
  172. IntValue18.Parent = Model0
  173. BoolValue19.Name = "IsOnTeam"
  174. BoolValue19.Parent = Model0
  175. BrickColorValue20.Name = "Team"
  176. BrickColorValue20.Parent = BoolValue19
  177. BrickColorValue20.Value = BrickColor.new("Really black")
  178. BoolValue21.Name = "ShowTag"
  179. BoolValue21.Parent = BoolValue19
  180. BoolValue22.Name = "IgnoreCombatFF"
  181. BoolValue22.Parent = Model0
  182. BoolValue22.Value = true
  183. BoolValue23.Name = "DropWeapon"
  184. BoolValue23.Parent = Model0
  185. BoolValue23.Value = true
  186. Vector3Value24.Name = "PathTo"
  187. Vector3Value24.Parent = Model0
  188. BoolValue25.Name = "Wander"
  189. BoolValue25.Parent = Model0
  190. BoolValue25.Value = true
  191. BoolValue26.Name = "PrintMap"
  192. BoolValue26.Parent = Model0
  193. BodyColors27.Parent = Model0
  194. BodyColors27.HeadColor = BrickColor.new("Bright yellow")
  195. BodyColors27.LeftArmColor = BrickColor.new("Bright yellow")
  196. BodyColors27.LeftLegColor = BrickColor.new("Br. yellowish green")
  197. BodyColors27.RightArmColor = BrickColor.new("Bright yellow")
  198. BodyColors27.RightLegColor = BrickColor.new("Br. yellowish green")
  199. BodyColors27.TorsoColor = BrickColor.new("Bright blue")
  200. BoolValue28.Name = "ForceColors"
  201. BoolValue28.Parent = BodyColors27
  202. Script29.Name = "Full Animation"
  203. Script29.Parent = Model0
  204. table.insert(cors,sandbox(Script29,function()
  205. --[[Made by Jammer622 @[http://www.roblox.com/Advanced-Player-AI-item?id=59391730],
  206. This is the ORIGINAL model, if you see others, they are stolen.
  207. Scripts mixed from vanilla Animate, Health, and Sound,
  208. with much custom content by myself, making them great AIs.
  209. No help from Miked's scripts, I made my own joint script.
  210. If you find any glitches, bugs, or just want to suggest an idea, please message me.
  211. My team works hard on these AIs, please don't make attempts to steal them.
  212. Your feedback is extremely appreciated!
  213.  
  214. _---=CREDITS=---_
  215. The Roblox Team Without them, none of this would be possible.
  216. Vanilla Sound
  217. Vanilla Health
  218. Vanilla Animate
  219. Jammer622 That's me, main programmer and weapon publisher.
  220. Main Developer
  221. Health GUI Script
  222. Animation Work
  223. Relationship Work
  224. Wandering
  225. Pathing (Map Generation)
  226. Weapon Usage
  227. Weapon (Re)Publishing
  228. Sonypony458
  229. McDonalds Drink
  230. Customization
  231. Teamwork AI
  232. Model Variables
  233. Setting Wiki [Below]
  234. Macdeath I owe it to him for keeping me on track during this.
  235. Feature Inspiration
  236. Problem Solving
  237. Suggestions
  238. lah30303 Amazing pathing work goes to this fine sir.
  239. Pathing (Pathing Generation/System)
  240.  
  241. _---=SETTINGS=---_
  242. Inside this model's file, you'll find several values that can be changed.
  243. DropWeapon -This sets whether or not the bot will drop any equipped weapon upon dying.
  244. Force_Pants -This must be set through Spawners.
  245. Force_Shirt -This must be set through Spawners.
  246. Force_Weapon -This must be set through Spawners.
  247. Force_Hat -This must be set through Spawners.
  248. IgnoreCombatFF -This sets whether or not the bot will allow friendly fire during combat.
  249. IsAPlayer -This is a tag to specify this bot's existance to other AIs.
  250. IsOnTeam -This sets whether or not the bot is on a team.
  251. ShowTag -This sets whether or not the bot's team color name shows up beside its own.
  252. Team -This sets the bot's team color.
  253. PathTo -This is an experimental pathfinding engine. Use at your own risk!
  254. PrintMap -This prints maps generated when using PathTo. Use at your own risk!
  255. Respawn -This sets whether the bot will respawn or not upon death.
  256. Custom_Name -This must be set through Spawners.
  257. Wander -This sets whether the bot is stationary or if it moves, but not if it uses weapons or not.
  258. ]]
  259. print("Player Bot Loading")
  260. Delay(0, function() --Vanilla Sound
  261. function waitForChild(parent, childName)
  262. local child = parent:findFirstChild(childName)
  263. if child then return child end
  264. while true do
  265. child = parent.ChildAdded:wait()
  266. if child.Name==childName then return child end
  267. end
  268. end
  269. function newSound(id)
  270. local sound = Instance.new("Sound")
  271. sound.SoundId = id
  272. sound.archivable = false
  273. sound.Parent = script.Parent.Head
  274. return sound
  275. end
  276. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  277. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  278. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  279. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  280. local sJumping = newSound("rbxasset://sounds/button.wav")
  281. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  282. sRunning.Looped = true
  283. local Figure = script.Parent
  284. local Head = waitForChild(Figure, "Head")
  285. local Humanoid = waitForChild(Figure, "Humanoid")
  286. function onDied()
  287. sDied:Play()
  288. end
  289. function onState(state, sound)
  290. if state then
  291. sound:Play()
  292. else
  293. sound:Pause()
  294. end
  295. end
  296. function onRunning(speed)
  297. if speed>0 then
  298. sRunning:Play()
  299. else
  300. sRunning:Pause()
  301. end
  302. end
  303. Humanoid.Died:connect(onDied)
  304. Humanoid.Running:connect(onRunning)
  305. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  306. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  307. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  308. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  309. end)
  310. Delay(0, function() --Vanilla Health
  311. function waitForChild(parent, childName)
  312. local child = parent:findFirstChild(childName)
  313. if child then return child end
  314. while true do
  315. child = parent.ChildAdded:wait()
  316. if child.Name==childName then return child end
  317. end
  318. end
  319. local Figure = script.Parent
  320. local Humanoid = waitForChild(Figure, "Humanoid")
  321. local regening = false
  322. function regenHealth()
  323. if regening then return end
  324. regening = true
  325. while Humanoid.Health < Humanoid.MaxHealth do
  326. local s = wait(1)
  327. local health = Humanoid.Health
  328. if health > 0 and health < Humanoid.MaxHealth then
  329. local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
  330. health = health + newHealthDelta
  331. Humanoid.Health = math.min(health,Humanoid.MaxHealth)
  332. end
  333. end
  334. if Humanoid.Health > Humanoid.MaxHealth then
  335. Humanoid.Health = Humanoid.MaxHealth
  336. end
  337. regening = false
  338. end
  339. Humanoid.HealthChanged:connect(regenHealth)
  340. end)
  341. Delay(0, function() --Vanilla Animate, Multiple Additions
  342. function waitForChild(parent, childName)
  343. local child = parent:findFirstChild(childName)
  344. if child then return child end
  345. while true do
  346. child = parent.ChildAdded:wait()
  347. if child.Name==childName then return child end
  348. end
  349. end
  350. local Figure = script.Parent
  351. local Clone = Figure:Clone()
  352. local Torso = waitForChild(Figure, "Torso")
  353. local Joints = Torso:GetChildren()
  354. for All = 1, #Joints do
  355. if Joints.className == "Motor" or Joints.className == "Motor6D" then
  356. Joints[All]:Remove()
  357. end
  358. end
  359. local RightShoulder = Instance.new("Motor")
  360. local LeftShoulder = Instance.new("Motor")
  361. local RightHip = Instance.new("Motor")
  362. local LeftHip = Instance.new("Motor")
  363. local Neck = Instance.new("Motor")
  364. local Humanoid = waitForChild(Figure, "Humanoid")
  365. ZStat = 1
  366. ZStat2 = 0
  367. local pose = "Standing"
  368. RightShoulder.Part0 = Torso
  369. RightShoulder.Part1 = Figure["Right Arm"]
  370. RightShoulder.MaxVelocity = 0.15
  371. RightShoulder.Name = "Right Shoulder"
  372. RightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  373. RightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  374. RightShoulder.Parent = Torso
  375. LeftShoulder.Part0 = Torso
  376. LeftShoulder.Part1 = Figure["Left Arm"]
  377. LeftShoulder.MaxVelocity = 0.15
  378. LeftShoulder.Name = "Left Shoulder"
  379. LeftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  380. LeftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  381. LeftShoulder.Parent = Torso
  382. RightHip.Part0 = Torso
  383. RightHip.Part1 = Figure["Right Leg"]
  384. RightHip.MaxVelocity = 0.1
  385. RightHip.Name = "Right Hip"
  386. RightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  387. RightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  388. RightHip.Parent = Torso
  389. LeftHip.Part0 = Torso
  390. LeftHip.Part1 = Figure["Left Leg"]
  391. LeftHip.MaxVelocity = 0.1
  392. LeftHip.Name = "Left Hip"
  393. LeftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  394. LeftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  395. LeftHip.Parent = Torso
  396. Neck.Part0 = Torso
  397. Neck.Part1 = Figure["Head"]
  398. Neck.MaxVelocity = 0.1
  399. Neck.Name = "Neck"
  400. Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  401. Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  402. Neck.Parent = Torso
  403. local toolAnim = "None"
  404. local toolAnimTime = 0
  405. SpawnModel = Instance.new("Model")
  406. function onRunning(speed)
  407. if speed>0 then
  408. pose = "Running"
  409. else
  410. pose = "Standing"
  411. end
  412. end
  413. function CheckTag(Tag)
  414. if script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
  415. if Tag.Value.Character:FindFirstChild("IsLocalEnemy") == nil then
  416. if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and script.Parent.IsOnTeam.Team.Value == Tag.Value.TeamColor) or script.Parent.IsOnTeam.Value == false then
  417. local Tag2 = Instance.new("CFrameValue", Tag.Value.Character)
  418. Tag2.Name = "IsLocalEnemy"
  419. print(Tag.Value.Character.Name .." Has Become An Outlaw")
  420. end
  421. end
  422. if Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
  423. Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
  424. end
  425. local Found = Instance.new("CFrameValue", Tag.Value.Character)
  426. Found.Name = "Loc" ..script.Parent.Name
  427. game:GetService("Debris"):AddItem(Found, 3)
  428. elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Players:FindFirstChild(Tag.Value) ~= nil and game.Players[Tag.Value].Character ~= nil then
  429. if game.Players[Tag.Value].Character:FindFirstChild("IsLocalEnemy") == nil then
  430. if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and script.Parent.IsOnTeam.Team.Value == game.Players[Tag.Value].TeamColor) or script.Parent.IsOnTeam.Value == false then
  431. local Tag2 = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
  432. Tag2.Name = "IsLocalEnemy"
  433. print(Tag.Value .." Has Become An Outlaw")
  434. end
  435. end
  436. if game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
  437. game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
  438. end
  439. local Found = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
  440. Found.Name = "Loc" ..script.Parent.Name
  441. game:GetService("Debris"):AddItem(Found, 3)
  442. elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
  443. if game.Workspace[Tag.Value]:FindFirstChild("IsLocalEnemy") == nil then
  444. if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and Workspace[Tag.Value].IsOnTeam.Value == true and script.Parent.IsOnTeam.Team.Value == Workspace[Tag.Value].IsOnTeam.Team.Value) or script.Parent.IsOnTeam.Value == false or Workspace[Tag.Value].IsOnTeam.Value == false then
  445. local Tag2 = Instance.new("CFrameValue", game.Workspace[Tag.Value])
  446. Tag2.Name = "IsLocalEnemy"
  447. print(Tag.Value .." Has Become An Outlaw")
  448. end
  449. end
  450. if game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
  451. game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
  452. end
  453. local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
  454. Found.Name = "Loc" ..script.Parent.Name
  455. game:GetService("Debris"):AddItem(Found, 3)
  456. elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
  457. local Found = Instance.new("CFrameValue", Tag.Value.Character)
  458. Found.Name = "Loc" ..script.Parent.Name
  459. game:GetService("Debris"):AddItem(Found, 3)
  460. elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
  461. local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
  462. Found.Name = "Loc" ..script.Parent.Name
  463. game:GetService("Debris"):AddItem(Found, 3)
  464. end
  465. end
  466. function CheckSpawns(Object)
  467. local Parts = Object:GetChildren()
  468. for Check = 1, #Parts do
  469. if Parts[Check].className == "SpawnLocation" then
  470. local I = Instance.new("Vector3Value", SpawnModel)
  471. I.Value = Parts[Check].Position
  472. end
  473. CheckSpawns(Parts[Check])
  474. end
  475. end
  476. function onDied()
  477. pose = "Dead"
  478. Delay(5, function()
  479. if script.Parent.Respawn.Value == true then
  480. CheckSpawns(Workspace)
  481. local Spawn = SpawnModel:GetChildren()
  482. Clone.Parent = game.Workspace
  483. if #Spawn > 0 then
  484. Spawn = Spawn[math.random(1, #Spawn)].Value
  485. Clone:MoveTo(Spawn)
  486. else
  487. Clone:MoveTo(Vector3.new(0, 50, 0))
  488. end
  489. end
  490. Figure:Remove()
  491. return
  492. end)
  493. end
  494. function onJumping()
  495. pose = "Jumping"
  496. end
  497. function onClimbing()
  498. pose = "Climbing"
  499. end
  500. function onGettingUp()
  501. pose = "GettingUp"
  502. end
  503. function onFreeFall()
  504. pose = "FreeFall"
  505. end
  506. function onFallingDown()
  507. pose = "FallingDown"
  508. end
  509. function onSeated()
  510. pose = "Seated"
  511. end
  512. function onPlatformStanding()
  513. pose = "PlatformStanding"
  514. end
  515. function moveJump()
  516. RightShoulder.MaxVelocity = 0.5
  517. LeftShoulder.MaxVelocity = 0.5
  518. RightShoulder.DesiredAngle = (3.14/ZStat)
  519. LeftShoulder.DesiredAngle = (-3.14/ZStat)
  520. RightHip.DesiredAngle = (0)
  521. LeftHip.DesiredAngle = (0)
  522. end
  523. function moveFreeFall()
  524. RightShoulder.MaxVelocity = 0.5
  525. LeftShoulder.MaxVelocity = 0.5
  526. RightShoulder.DesiredAngle = (3.14/ZStat)
  527. LeftShoulder.DesiredAngle = (-3.14/ZStat)
  528. RightHip.DesiredAngle = (0)
  529. LeftHip.DesiredAngle = (0)
  530. end
  531. function moveSit()
  532. RightShoulder.MaxVelocity = 0.15
  533. LeftShoulder.MaxVelocity = 0.15
  534. RightShoulder.DesiredAngle = (3.14 /2)
  535. LeftShoulder.DesiredAngle = (-3.14 /2)
  536. RightHip.DesiredAngle = (3.14 /2)
  537. LeftHip.DesiredAngle = (-3.14 /2)
  538. end
  539. function getTool()
  540. for _, kid in ipairs(Figure:GetChildren()) do
  541. if kid.className == "Tool" then return kid end
  542. end
  543. return nil
  544. end
  545. function getToolAnim(tool)
  546. for _, c in ipairs(tool:GetChildren()) do
  547. if c.Name == "toolanim" and c.className == "StringValue" then
  548. return c
  549. end
  550. end
  551. return nil
  552. end
  553. function animateTool()
  554. if (toolAnim == "None") then
  555. RightShoulder.DesiredAngle = (1.57)
  556. return
  557. end
  558. if (toolAnim == "Slash") then
  559. RightShoulder.MaxVelocity = 0.5
  560. RightShoulder.DesiredAngle = (0)
  561. return
  562. end
  563. if (toolAnim == "Lunge") then
  564. RightShoulder.MaxVelocity = 0.5
  565. LeftShoulder.MaxVelocity = 0.5
  566. RightHip.MaxVelocity = 0.5
  567. LeftHip.MaxVelocity = 0.5
  568. RightShoulder.DesiredAngle = (1.57)
  569. LeftShoulder.DesiredAngle = (1.0)
  570. RightHip.DesiredAngle = (1.57)
  571. LeftHip.DesiredAngle = (1.0)
  572. return
  573. end
  574. end
  575. function move(time)
  576. local amplitude
  577. local frequency
  578. if (pose == "Jumping") then
  579. moveJump()
  580. return
  581. end
  582. if (pose == "FreeFall") then
  583. moveFreeFall()
  584. return
  585. end
  586. if (pose == "Seated") then
  587. moveSit()
  588. return
  589. end
  590. local climbFudge = 0
  591. if (pose == "Running") then
  592. RightShoulder.MaxVelocity = 0.15
  593. LeftShoulder.MaxVelocity = 0.15
  594. amplitude = 1
  595. frequency = 9
  596. elseif (pose == "Climbing") then
  597. RightShoulder.MaxVelocity = 0.5
  598. LeftShoulder.MaxVelocity = 0.5
  599. amplitude = 1
  600. frequency = 9
  601. climbFudge = 3.14
  602. else
  603. amplitude = 0.1
  604. frequency = 1
  605. end
  606. desiredAngle = amplitude * math.sin(time*frequency)
  607. RightShoulder.DesiredAngle = (desiredAngle + climbFudge) + ZStat2
  608. LeftShoulder.DesiredAngle = (desiredAngle - climbFudge) -ZStat2
  609. RightHip.DesiredAngle = (-desiredAngle)
  610. LeftHip.DesiredAngle = (-desiredAngle)
  611. local tool = getTool()
  612. if tool then
  613. animStringValueObject = getToolAnim(tool)
  614. if animStringValueObject then
  615. toolAnim = animStringValueObject.Value
  616. animStringValueObject.Parent = nil
  617. toolAnimTime = time + .3
  618. end
  619. if time > toolAnimTime then
  620. toolAnimTime = 0
  621. toolAnim = "None"
  622. end
  623. animateTool()
  624. else
  625. toolAnim = "None"
  626. toolAnimTime = 0
  627. end
  628. end
  629. Humanoid.Died:connect(onDied)
  630. Humanoid.Running:connect(onRunning)
  631. Humanoid.Jumping:connect(onJumping)
  632. Humanoid.Climbing:connect(onClimbing)
  633. Humanoid.GettingUp:connect(onGettingUp)
  634. Humanoid.FreeFalling:connect(onFreeFall)
  635. Humanoid.FallingDown:connect(onFallingDown)
  636. Humanoid.Seated:connect(onSeated)
  637. Humanoid.PlatformStanding:connect(onPlatformStanding)
  638. Humanoid.ChildAdded:connect(CheckTag)
  639. OriginalTime = 0.1
  640. Time = OriginalTime
  641. while Figure.Parent~=nil do
  642. Time = Time + 0.1
  643. wait(OriginalTime)
  644. move(Time)
  645. end
  646. end)
  647. Delay(0, function() --lah30303's Pathing Script
  648. function CalcMoves(map, px, py, tx, ty)
  649. if map[ty][tx] ~= 0 then
  650. return nil
  651. end
  652. local openlist, closedlist, listk, closedk, tempH, tempG, xsize, ysize, curbase = {}, {}, 1, 0, math.abs(px - tx) + math.abs(py - ty), 0, #map[1], #map, {}
  653. openlist[1] = {x = px, y = py, g = 0, h = tempH, f = 0 + tempH ,par = 1}
  654. local nodenumber = 0
  655. while listk > 0 do
  656. nodenumber = nodenumber + 1
  657. if nodenumber / ScanSkip == math.floor(nodenumber / ScanSkip) then
  658. wait()
  659. if DebugPathing == true then
  660. print("Node", nodenumber)
  661. end
  662. end
  663. closedk = closedk + 1
  664. table.insert(closedlist, closedk, openlist[1])
  665. curbase = closedlist[closedk]
  666. if closedlist[closedk].x == tx and closedlist[closedk].y == ty then
  667. return closedlist
  668. end
  669. openlist[1] = openlist[listk]
  670. table.remove(openlist, listk)
  671. listk = listk - 1
  672. local v = 1
  673. while true do
  674. local u = v
  675. if 2 * u + 1 <= listk then
  676. if openlist[u].f >= openlist[2 * u].f then
  677. v = 2 * u
  678. end
  679. if openlist[v].f >= openlist[2 * u + 1].f then
  680. v = 2 * u + 1
  681. end
  682. elseif 2 * u <= listk then
  683. if openlist[u].f >= openlist[2 * u].f then
  684. v = 2 * u
  685. end
  686. end
  687. if u ~= v then
  688. local temp = openlist[u]
  689. openlist[u] = openlist[v]
  690. openlist[v] = temp
  691. else
  692. break
  693. end
  694. end
  695.  
  696. local tocheck = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}} --[1]Right, [2]Left, [3]Down, [4]Up, [5]UpLeft, [6]UpRight, [7]DownLeft, [8]DownRight
  697. if closedk > 0 then
  698. for k = 1, closedk do
  699. for i, v in pairs(tocheck) do
  700. if closedlist[k].x == curbase.x + v[1] and closedlist[k].y == curbase.y + v[2] then
  701. tocheck[i] = nil
  702. end
  703. end
  704. end
  705. end
  706. for i, v in pairs(tocheck) do
  707. local a = curbase.x + v[1]
  708. local b = curbase.y + v[2]
  709. if a > xsize or a < 1 or b > ysize or b < 1 then
  710. tocheck[i] = nil
  711. end
  712. end
  713. for i, v in pairs(tocheck) do
  714. local a, b = curbase.x + v[1], curbase.y + v[2]
  715. if a <= xsize and a >= 1 and b <= ysize and b >= 1 and map[b][a] ~= 0 then
  716. tocheck[i] = nil
  717. end
  718. end
  719. tempG = curbase.g + 1
  720. tempDiagG = curbase.g + 1.4
  721. for k = 1, listk do
  722. for i, v in pairs(tocheck) do
  723. if openlist[k].x == curbase.x + v[1] and openlist[k].y == curbase.y + 1 and openlist[k].g > tempG then
  724. tempH = math.abs((curbase.x + v[1])-tx) + math.abs((curbase.y + v[1])-ty)
  725. table.insert(openlist, k, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG + tempH, par = closedk})
  726. local m = k
  727. while m ~= 1 do
  728. if openlist[m].f <= openlist[math.floor(m/2)].f then
  729. temp = openlist[math.floor(m/2)]
  730. openlist[math.floor(m/2)] = openlist[m]
  731. openlist[m] = temp
  732. m = math.floor(m/2)
  733. else
  734. break
  735. end
  736. tocheck[i] = nil
  737. end
  738. end
  739. end
  740. end
  741. for i, v in pairs(tocheck) do
  742. listk = listk + 1
  743. tempH = math.abs((curbase.x + v[1]) - tx) + math.abs((curbase.y + v[2]) - ty)
  744. table.insert(openlist, listk, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG+tempH, par = closedk})
  745. m = listk
  746. while m ~= 1 do
  747. if openlist[m].f <= openlist[math.floor(m/2)].f then
  748. temp = openlist[math.floor(m/2)]
  749. openlist[math.floor(m/2)] = openlist[m]
  750. openlist[m] = temp
  751. m = math.floor(m/2)
  752. else
  753. break
  754. end
  755. end
  756. end
  757. end
  758. return nil
  759. end
  760.  
  761.  
  762. function CalcPath(closedlist)
  763.  
  764. if closedlist == nil or table.getn(closedlist) == 1 then
  765. return nil
  766. end
  767. local path = {}
  768. local pathIndex = {}
  769. local last = table.getn(closedlist)
  770. table.insert(pathIndex,1,last)
  771.  
  772. local i = 1
  773. while pathIndex[i] > 1 do
  774. i = i + 1
  775. table.insert(pathIndex, i, closedlist[pathIndex[i - 1]].par)
  776. end
  777.  
  778. for n = table.getn(pathIndex) - 1, 1, -1 do
  779. table.insert(path, {x = closedlist[pathIndex[n]].x, y = closedlist[pathIndex[n]].y})
  780. end
  781.  
  782. closedlist = nil
  783. return path
  784. end
  785. end)
  786. Delay(0, function() --Main Artificial Intelligence Scripting/Path Grid Generator
  787. local Base
  788. if script.Parent:FindFirstChild("BASE") == nil then
  789. Base = Instance.new("Part")
  790. Base.Transparency = 1
  791. Base.TopSurface = "Smooth"
  792. Base.BottomSurface = "Smooth"
  793. Base.CanCollide = false
  794. Base.Anchored = true
  795. Base.Locked = true
  796. Base.BrickColor = BrickColor.new(0, 0, 0)
  797. Base.Name = "BASE"
  798. Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
  799. Base.Parent = script.Parent
  800. else
  801. Base = script.Parent.BASE
  802. Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
  803. end
  804. function Jump()
  805. script.Parent.Humanoid.Jump = true
  806. end
  807. function Check(Hit)
  808. if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent.Parent ~= nil then
  809. if Hit.Parent:FindFirstChild("Humanoid") == nil and Hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
  810. Jump()
  811. end
  812. end
  813. end
  814. script.Parent.Torso.Touched:connect(Check)
  815. function Prep(Target, Current, Attempts)
  816. if Attempts == nil then
  817. Attempts = 1000
  818. end
  819. local Hit = false
  820. local Tag = Base:Clone()
  821. Tag.Position = Target
  822. Tag.Parent = script.Parent
  823. local TagRay = Ray.new(Tag.CFrame.p, (CFrame.new(Tag.CFrame.p - Vector3.new(0, 3, 0)).p - Tag.CFrame.p).Unit * 40)
  824. local TRHit, TRPos = game.Workspace:FindPartOnRay(TagRay, script.Parent)
  825. if TRHit ~= nil then
  826. Hit = true
  827. end
  828. if Tag.Parent ~= nil then
  829. Tag:Remove()
  830. end
  831. if Hit == false and Attempts > 0 and script.Parent.Wander.Value == true then
  832. Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base, Attempts - 1)
  833. elseif script.Parent.Wander.Value == true then
  834. local TargetRay = Ray.new(script.Parent.Torso.CFrame.p, (CFrame.new(Target).p - script.Parent.Torso.CFrame.p).Unit * ((Target - script.Parent.Torso.Position).Magnitude - 3))
  835. local THit, TPos = game.Workspace:FindPartOnRay(TargetRay, script.Parent)
  836. local TrueTarget = script.Parent.Torso.Position
  837. if THit ~= nil then
  838. for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - TPos).Magnitude) do
  839. local TR2 = Ray.new(script.Parent.Torso.CFrame.p + (TPos - script.Parent.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - script.Parent.Torso.CFrame.p).Unit * 3)
  840. local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
  841. if TH2 ~= nil and TH2.Name ~= "Lava" then
  842. TrueTarget = TP2
  843. else
  844. break
  845. end
  846. end
  847. else
  848. for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - Target).Magnitude) do
  849. local TR2 = Ray.new(script.Parent.Torso.CFrame.p + (Target - script.Parent.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - script.Parent.Torso.CFrame.p).Unit * 3)
  850. local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
  851. if TH2 ~= nil and TH2.Name ~= "Lava" then
  852. TrueTarget = TP2
  853. else
  854. break
  855. end
  856. end
  857. end
  858. script.Parent.Humanoid:MoveTo(TrueTarget, Current)
  859. end
  860. end
  861. function ZHit(Part)
  862. if script.Parent:FindFirstChild("IsAZombie") ~= nil and script.Parent.Humanoid.Health > 0 and Part ~= nil and Part.Parent ~= nil and Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent:FindFirstChild("IsAZombie") == nil then
  863. Part.Parent.Humanoid:TakeDamage(2)
  864. script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + 1
  865. script.Parent.Humanoid:TakeDamage(-1)
  866. end
  867. end
  868. script.Parent["Right Arm"].Touched:connect(ZHit)
  869. script.Parent["Left Arm"].Touched:connect(ZHit)
  870. CurrentMap = {}
  871. MapMask = {}
  872. MapVar = {0, 0, 0, 0, 0}
  873. BlockScanned = 0
  874. ScanSkip = 5
  875. DebugPathing = true
  876. function GenerateMap(PathPos)
  877. CurrentMap = {}
  878. MapMask = {}
  879. MapVar = {0, 0, 0, 0, 0}
  880. BlockScanned = 0
  881. MapVariables = ScanParts(Workspace, 1)
  882. for MapX = 1, math.max(-MapVariables[1], MapVariables[2]) * 2 + 1 do
  883. CurrentMap[MapX] = {}
  884. for MapY = 1, math.max(-MapVariables[3], MapVariables[4]) * 2 + 1 do
  885. CurrentMap[MapX][MapY] = 0
  886. end
  887. end
  888. for MaskX = 1, #CurrentMap do
  889. MapMask[MaskX] = {}
  890. for MaskY = 1, #CurrentMap[MaskX] do
  891. MapMask[MaskX][MaskY] = {MapVariables[1] + MaskX - 0.5, MapVariables[1] + MaskY - 0.5}
  892. end
  893. end
  894. ScanParts(Workspace, 2, MapVariables)
  895. wait(1)
  896. if script.Parent.PrintMap.Value == true then
  897. print("Printing Map...")
  898. for ClearPrint = 1, 250 do
  899. wait()
  900. print()
  901. end
  902. for PrintX = 1, #CurrentMap do
  903. local PrintZ = ""
  904. for PrintY = 1, #CurrentMap[PrintX] do
  905. PrintZ = PrintZ ..CurrentMap[PrintX][PrintY]
  906. end
  907. print(PrintZ)
  908. wait(0.1)
  909. end
  910. end
  911. local MapCoords = {0, 0, 0, 0}
  912. local Distance = math.huge
  913. for MPX = 1, #CurrentMap do
  914. for MPY = 1, #CurrentMap[MPX] do
  915. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude < Distance then
  916. MapCoords = {MPX, MPY, 0, 0}
  917. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude
  918. end
  919. end
  920. end
  921. local Distance = math.huge
  922. for MPX = 1, #CurrentMap do
  923. for MPY = 1, #CurrentMap[MPX] do
  924. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.PathTo.Value.X, 0, script.Parent.PathTo.Value.Z)).Magnitude < Distance then
  925. MapCoords = {MapCoords[1], MapCoords[2], math.min(MPX, #CurrentMap) - 1, math.min(MPY, #CurrentMap[1] - 1)}
  926. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.PathTo.Value.X, 0, script.Parent.PathTo.Value.Z)).Magnitude
  927. end
  928. end
  929. end
  930. for i, v in pairs(CalcPath(CalcMoves(CurrentMap, MapCoords[1], MapCoords[2], MapCoords[3], MapCoords[4]))) do
  931. local Timer = 20
  932. local pX = v["x"]
  933. local pY = v["y"]
  934. local pTo = Vector3.new(MapMask[pX][pY][1], 0, MapMask[pX][pY][2])
  935. pTo = pTo + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit
  936. while (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude > 2.5 and Timer > 0 do
  937. script.Parent.Humanoid:MoveTo(pTo, Base)
  938. Timer = Timer - 1
  939. if Timer == 10 then
  940. script.Parent.Humanoid.Jump = true
  941. end
  942. wait(0.1)
  943. end
  944. if Timer == 0 then
  945. if (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude <= 5 then
  946. script.Parent.Torso.CFrame = script.Parent.Torso.CFrame + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit * (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude
  947. else
  948. break
  949. end
  950. end
  951. end
  952. end
  953. function ScanParts(CurrentModel, CurrentStage, Variables)
  954. local X = CurrentModel:GetChildren()
  955. for I = 1, #X do
  956. if #X[I]:GetChildren() > 0 then
  957. ScanParts(X[I], 1, Variables)
  958. end
  959. if X[I].ClassName == "Part" or X[I].ClassName == "WedgePart" or X[I].ClassName == "CornerWedgePart" or X[I].ClassName == "TrussPart" or X[I].ClassName == "SpawnLocation" or X[I].ClassName == "Seat" or X[I].ClassName == "VehicleSeat" or X[I].ClassName == "SkateboardPlatform" then
  960. BlockScanned = BlockScanned + 1
  961. if BlockScanned / ScanSkip == math.floor(BlockScanned / ScanSkip) then
  962. wait()
  963. if DebugPathing == true then
  964. print("Block", BlockScanned)
  965. end
  966. end
  967. if CurrentStage == 1 then
  968. MapVar[1] = math.min(math.ceil(X[I].Position.X - X[I].Size.X / 2), MapVar[1])
  969. MapVar[2] = math.max(math.floor(X[I].Position.X + X[I].Size.X / 2), MapVar[2])
  970. MapVar[3] = math.min(math.ceil(X[I].Position.Z - X[I].Size.Z / 2), MapVar[3])
  971. MapVar[4] = math.max(math.floor(X[I].Position.Z + X[I].Size.Z / 2), MapVar[4])
  972. elseif CurrentStage == 2 and ((X[I].Position.Y + X[I].Size.Y / 2 > script.Parent.Torso.Position.Y + 2 and X[I].Position.Y - X[I].Size.Y / 2 < script.Parent.Torso.Position.Y + 2) or X[I].Position.Y + X[I].Size.Y / 2 < script.Parent.Torso.Position.Y - 8) then
  973. local BlockStart = {X[I].Position.X - X[I].Size.X / 2, X[I].Position.Z - X[I].Size.Z / 2}
  974. local BlockEnd = {X[I].Position.X + X[I].Size.X / 2, X[I].Position.Z + X[I].Size.Z / 2}
  975. local BlockCoords = {0, 0, 0, 0}
  976. local Distance = math.huge
  977. for MPX = 1, #CurrentMap do
  978. for MPY = 1, #CurrentMap[MPX] do
  979. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude < Distance then
  980. BlockCoords = {MPX, MPY, 0, 0}
  981. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude
  982. end
  983. end
  984. end
  985. local Distance = math.huge
  986. for MPX = 1, #CurrentMap do
  987. for MPY = 1, #CurrentMap[MPX] do
  988. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude < Distance then
  989. BlockCoords = {BlockCoords[1], BlockCoords[2], MPX, MPY}
  990. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude
  991. end
  992. end
  993. end
  994. for XGrid = BlockCoords[2], BlockCoords[4] do
  995. for YGrid = BlockCoords[1], BlockCoords[3] do
  996. CurrentMap[XGrid][YGrid] = 1
  997. end
  998. end
  999. end
  1000. end
  1001. end
  1002. if CurrentStage == 1 then
  1003. MapVar[5] = {MapVar[1] + MapVar[2] / 2, MapVar[3] + MapVar[4] / 2}
  1004. return MapVar
  1005. end
  1006. end
  1007. IsInCombat = false
  1008. while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") == nil do
  1009. local Distance = 100
  1010. local Target = nil
  1011. IsInCombat = false
  1012. local Players = Workspace:GetChildren()
  1013. for Check = 1, #Players do
  1014. if Players[Check] ~= script.Parent and ((Players[Check]:FindFirstChild("Humanoid") ~= nil and (Players[Check]:FindFirstChild("IsAZombie") ~= nil or Players[Check]:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or (script.Parent.IsOnTeam.Value == true and Players[Check]:FindFirstChild("IsOnTeam") ~= nil and Players[Check].IsOnTeam.Value == true and script.Parent.IsOnTeam.Team.Value ~= Players[Check].IsOnTeam.Team.Value) or (game.Players:GetPlayerFromCharacter(Players[Check]) ~= nil and script.Parent.IsOnTeam.Value == true and game.Players:GetPlayerFromCharacter(Players[Check]).Neutral == false and game.Players:GetPlayerFromCharacter(Players[Check]).TeamColor ~= script.Parent.IsOnTeam.Team.Value)) and Players[Check].Humanoid.Health > 0) or (Players[Check]:FindFirstChild("Zombie") ~= nil and Players[Check].Zombie.ClassName == "Humanoid" and Players[Check].Zombie.Health > 0)) and Players[Check]:FindFirstChild("Torso") ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= 100 then
  1015. local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
  1016. local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
  1017. if Hit ~= nil and Hit.Parent ~= nil and ((Hit.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent == Players[Check]) or (Hit.Parent.Parent ~= nil and Hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent.Parent == Players[Check])) then
  1018. local TeamTag = nil
  1019. local Parts = Players[Check]:GetChildren()
  1020. for X = 1, #Parts do
  1021. if Parts[X].Name == "TeamLoc" then
  1022. if Parts[X].Value == script.Parent.IsOnTeam.Team.Value then
  1023. TeamTag = Parts[X]
  1024. end
  1025. end
  1026. end
  1027. if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil or Parts[X] ~= nil or (Players[Check].Torso.Position - (script.Parent.Torso.Position + script.Parent.Torso.CFrame.lookVector * 50)).Magnitude <= 52 then
  1028. if script.Parent.IsOnTeam.Value == false then
  1029. if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
  1030. Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
  1031. end
  1032. local Found = Instance.new("CFrameValue", Players[Check])
  1033. Found.Name = "Loc" ..script.Parent.Name
  1034. game:GetService("Debris"):AddItem(Found, 3)
  1035. else
  1036. if Parts[X] ~= nil then
  1037. Parts[X]:Remove()
  1038. end
  1039. local Found = Instance.new("BrickColorValue", Players[Check])
  1040. Found.Name = "TeamLoc"
  1041. Found.Value = script.Parent.IsOnTeam.Team.Value
  1042. game:GetService("Debris"):AddItem(Found, 3)
  1043. if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
  1044. Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
  1045. end
  1046. local Found = Instance.new("CFrameValue", Players[Check])
  1047. Found.Name = "Loc" ..script.Parent.Name
  1048. game:GetService("Debris"):AddItem(Found, 3)
  1049. end
  1050. end
  1051. if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
  1052. Target = Players[Check].Torso
  1053. Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
  1054. end
  1055. end
  1056. end
  1057. end
  1058. if Target == nil then
  1059. local HasTool = false
  1060. local ToolCheck = script.Parent:GetChildren()
  1061. for Check = 1, #ToolCheck do
  1062. if ToolCheck[Check].ClassName == "Tool" then
  1063. HasTool = true
  1064. end
  1065. end
  1066. if HasTool == false then
  1067. Distance = 100
  1068. for Check = 1, #Players do
  1069. if Players[Check].ClassName == "Tool" and Players[Check]:FindFirstChild("Handle") ~= nil and Players[Check]:FindFirstChild("Active") ~= nil and Players[Check]:FindFirstChild("TargetPos") ~= nil and Players[Check]:FindFirstChild("Type") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
  1070. local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
  1071. local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
  1072. if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
  1073. Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
  1074. Target = Players[Check]
  1075. end
  1076. end
  1077. end
  1078. if Target ~= nil and Target.ClassName == "Tool" then
  1079. if Distance <= 5 and HasTool == false then
  1080. Target.Parent = script.Parent
  1081. HasTool = true
  1082. else
  1083. Prep(Target.Handle.Position, Base)
  1084. end
  1085. else
  1086. for Check = 1, #Players do
  1087. if Players[Check].Name == "Crate" and Players[Check]:FindFirstChild("OpenCrate") ~= nil and Players[Check].OpenCrate.Value == false and (Players[Check].Position - script.Parent.Torso.Position).Magnitude <= Distance then
  1088. local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
  1089. local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
  1090. if Hit ~= nil and Hit == Players[Check] then
  1091. Target = Players[Check]
  1092. Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
  1093. end
  1094. end
  1095. end
  1096. if Target ~= nil then
  1097. script.Parent.Humanoid:MoveTo(Target.Position, Target)
  1098. if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
  1099. Target.OpenCrate.Value = true
  1100. end
  1101. else
  1102. local HasHat = false
  1103. local HatCheck = script.Parent:GetChildren()
  1104. for Check = 1, #HatCheck do
  1105. if ToolCheck[Check].ClassName == "Hat" then
  1106. HasHat = true
  1107. end
  1108. end
  1109. if HasHat == false then
  1110. Distance = 100
  1111. for Check = 1, #Players do
  1112. if Players[Check].ClassName == "Hat" and Players[Check]:FindFirstChild("Handle") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
  1113. local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
  1114. local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
  1115. if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
  1116. Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
  1117. Target = Players[Check]
  1118. end
  1119. end
  1120. end
  1121. if Target ~= nil and Target.ClassName == "Hat" then
  1122. if Distance <= 5 and HasHat == false then
  1123. Target.Parent = script.Parent
  1124. HasHat = true
  1125. else
  1126. Prep(Target.Handle.Position, Base)
  1127. end
  1128. else
  1129. if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
  1130. if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
  1131. GenerateMap(script.Parent.PathTo.Value)
  1132. script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
  1133. elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
  1134. Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1135. end
  1136. else
  1137. Jump()
  1138. end
  1139. end
  1140. end
  1141. end
  1142. end
  1143. else
  1144. if Target == nil then
  1145. local Distance = 80
  1146. local Players = Workspace:GetChildren()
  1147. for Check = 1, #Players do
  1148. if Players[Check]:FindFirstChild("Humanoid") ~= nil and Players[Check] ~= script.Parent and Players[Check]:FindFirstChild("IsLocalEnemy") == nil and Players[Check]:FindFirstChild("Leader") ~= nil and Players[Check].Humanoid.Health > 0 and Players[Check]:FindFirstChild("Torso") ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
  1149. local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
  1150. local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
  1151. if Hit ~= nil and Hit.Parent ~= nil and ((Hit.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent == Players[Check]) or (Hit.Parent.Parent ~= nil and Hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent.Parent == Players[Check])) then
  1152. Target = Players[Check].Torso
  1153. Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
  1154. end
  1155. end
  1156. end
  1157. if Target ~= nil then
  1158. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 10
  1159. Prep(Position, Base)
  1160. else
  1161. if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
  1162. if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
  1163. GenerateMap(script.Parent.PathTo.Value)
  1164. script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
  1165. elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
  1166. Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1167. end
  1168. else
  1169. Jump()
  1170. end
  1171. end
  1172. else
  1173. if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
  1174. if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
  1175. GenerateMap(script.Parent.PathTo.Value)
  1176. script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
  1177. elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
  1178. Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1179. end
  1180. else
  1181. Jump()
  1182. end
  1183. end
  1184. end
  1185. else
  1186. local Weapon = nil
  1187. local ToolCheck = script.Parent:GetChildren()
  1188. for Check = 1, #ToolCheck do
  1189. if ToolCheck[Check].ClassName == "Tool" then
  1190. Weapon = ToolCheck[Check]
  1191. end
  1192. end
  1193. if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
  1194. if Weapon.Type.Value == "Melee" then
  1195. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1196. if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
  1197. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1198. Weapon.Active.Value = true
  1199. end
  1200. elseif Weapon.Type.Value == "Melee/Ranged" then
  1201. if Distance <= 10 then
  1202. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1203. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1204. Weapon.Active.Value = true
  1205. else
  1206. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Base)
  1207. if (Target.Position - script.Parent.Torso.Position).Magnitude <= 50 then
  1208. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1209. Weapon.Active.Value = true
  1210. end
  1211. end
  1212. elseif Weapon.Type.Value == "Melee/RangedMed" then
  1213. if Distance <= 10 then
  1214. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1215. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1216. Weapon.Active.Value = true
  1217. else
  1218. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
  1219. if (Target.Position - script.Parent.Torso.Position).Magnitude <= 40 then
  1220. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1221. Weapon.Active.Value = true
  1222. end
  1223. end
  1224. elseif Weapon.Type.Value == "Melee/RangedClose" then
  1225. if Distance <= 10 then
  1226. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1227. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1228. Weapon.Active.Value = true
  1229. else
  1230. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Base)
  1231. if (Target.Position - script.Parent.Torso.Position).Magnitude <= 30 then
  1232. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1233. Weapon.Active.Value = true
  1234. end
  1235. end
  1236. elseif Weapon.Type.Value == "Ranged" then
  1237. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
  1238. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1239. wait()
  1240. Weapon.Active.Value = true
  1241. elseif Weapon.Type.Value == "RangedMed" then
  1242. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 60, Base)
  1243. if Distance <= 70 then
  1244. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1245. wait()
  1246. Weapon.Active.Value = true
  1247. end
  1248. elseif Weapon.Type.Value == "RangedClose" then
  1249. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
  1250. if Distance <= 40 then
  1251. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1252. wait()
  1253. Weapon.Active.Value = true
  1254. end
  1255. elseif Weapon.Type.Value == "RangedAngle" and Distance <= 100 then
  1256. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * (script.Parent.Torso.Position - Target.Position).Magnitude + Target.Velocity
  1257. script.Parent.Humanoid:MoveTo(Position, Base)
  1258. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1259. wait()
  1260. Weapon.Active.Value = true
  1261. elseif Weapon.Type.Value == "RangedTactical" then
  1262. if Distance <= 30 then
  1263. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 50
  1264. Prep(Position, Base)
  1265. elseif Distance >= 50 then
  1266. Prep(Target.Position, Target)
  1267. end
  1268. if Distance <= 50 and Distance >= 30 then
  1269. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Target.Parent.Torso)
  1270. end
  1271. if Distance <= 60 then
  1272. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1273. wait()
  1274. Weapon.Active.Value = true
  1275. end
  1276. elseif Weapon.Type.Value == "Shuriken" then
  1277. if Distance <= 15 then
  1278. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20
  1279. Prep(Position, Base)
  1280. elseif Distance >= 30 then
  1281. Prep(Target.Position, Target)
  1282. end
  1283. if Distance <= 30 and Distance >= 15 then
  1284. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Target.Parent.Torso)
  1285. end
  1286. if Distance <= 50 then
  1287. Weapon.TargetPos.Value = (Target.Position + Target.Velocity / 2) + Vector3.new(math.random(-2, 2), math.random(-2, 2) + ((Target.Position + Target.Velocity / 2) - script.Parent.Torso.Position).Magnitude / 8, math.random(-2, 2))
  1288. wait()
  1289. Weapon.Active.Value = true
  1290. end
  1291. elseif Weapon.Type.Value == "HealDrink" then
  1292. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
  1293. Prep(Position, Base)
  1294. if script.Parent.Humanoid.Health < script.Parent.Humanoid.MaxHealth then
  1295. Weapon.Active.Value = true
  1296. end
  1297. elseif Weapon.Type.Value == "GrenadeDirect" then
  1298. if Distance >= 80 and Distance <= 100 then
  1299. Prep(Target.Position, Target)
  1300. wait(0.5)
  1301. Weapon.Active.Value = true
  1302. wait(0.5)
  1303. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
  1304. Prep(Position, Base)
  1305. else
  1306. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
  1307. Prep(Position, Base)
  1308. end
  1309. elseif Weapon.Type.Value == "Bomb" then
  1310. if Distance > 10 then
  1311. Prep(Target.Position, Target)
  1312. elseif Distance <= 10 then
  1313. Weapon.Active.Value = true
  1314. wait(2)
  1315. while Weapon ~= nil and Weapon:FindFirstChild("Handle") ~= nil and Weapon.Handle.Transparency == 1 do
  1316. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
  1317. wait(0.5)
  1318. end
  1319. end
  1320. elseif Weapon.Type.Value == "Backstab" then
  1321. if Distance >= 10 then
  1322. if (script.Parent.Torso.Position - (Target.Position + Target.CFrame.lookVector * 50)).Magnitude <= 52 then
  1323. Prep(Target.Position, Target)
  1324. else
  1325. if (script.Parent.Torso.Position - (Target.Position - Target.CFrame.lookVector * 15)).Magnitude <= 5 then
  1326. Prep(Target.Position, Base)
  1327. local backstab_time = 20
  1328. while backstab_time > 1 and (script.Parent.Torso.Position - Target.Position).Magnitude >= 4 do
  1329. wait(0.1)
  1330. backstab_time = backstab_time - 1
  1331. end
  1332. if (script.Parent.Torso.Position - Target.Position).Magnitude < 4 then
  1333. Weapon.Active.Value = true
  1334. end
  1335. else
  1336. Prep(Target.Position - Target.CFrame.lookVector * 15, Base)
  1337. end
  1338. end
  1339. else
  1340. Prep(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
  1341. if Distance <= 5 then
  1342. Weapon.Active.Value = true
  1343. end
  1344. end
  1345. elseif Weapon.Type.Value == "Crossbow" then
  1346. if Distance > 80 then
  1347. Prep(Target.Position, Target)
  1348. elseif Distance < 40 then
  1349. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100, Base)
  1350. elseif Distance <= 80 and Distance >= 40 then
  1351. Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * ((script.Parent.Torso.Position - Target.Position).Magnitude - 5), Base)
  1352. wait(0.2)
  1353. Weapon.TargetPos.Value = Target.Position + Target.Velocity / 8 + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1354. Weapon.Active.Value = true
  1355. end
  1356. end
  1357. IsInCombat = true
  1358. elseif Distance <= 100 then
  1359. local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
  1360. Prep(Position, Base)
  1361. end
  1362. end
  1363. if IsInCombat == true then
  1364. wait(0.2)
  1365. else
  1366. wait(0.6)
  1367. end
  1368. end
  1369. local Weapon = nil
  1370. local ToolCheck = script.Parent:GetChildren()
  1371. for Check = 1, #ToolCheck do
  1372. if ToolCheck[Check].ClassName == "Tool" then
  1373. Weapon = ToolCheck[Check]
  1374. end
  1375. end
  1376. if Weapon ~= nil and script.Parent.DropWeapon.Value == true then
  1377. Weapon.Parent = Workspace
  1378. elseif Weapon ~= nil then
  1379. Weapon:Remove()
  1380. end
  1381. if script.Parent:FindFirstChild("IsAZombie") ~= nil then
  1382. script.Parent.Name = "New Zombie"
  1383. script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + math.random(math.random(-50, -25), math.random(25, math.random(50, 100)))
  1384. wait()
  1385. script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
  1386. script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + math.random(math.random(-200, 0), math.random(100, math.random(200, 300))) / 100
  1387. ZStat = 2
  1388. ZStat2 = 1.57
  1389. Delay(1, function()
  1390. while script.Parent:FindFirstChild("Humanoid") ~= nil and script.Parent.Humanoid.Health > 0 do
  1391. script.Parent.Humanoid.MaxHealth = math.max(0, script.Parent.Humanoid.MaxHealth - 1)
  1392. script.Parent.Humanoid.Health = math.min(script.Parent.Humanoid.Health, script.Parent.Humanoid.MaxHealth)
  1393. wait(1)
  1394. end
  1395. end)
  1396. while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") ~= nil do
  1397. local Distance = 100
  1398. local Target = nil
  1399. local Players = Workspace:GetChildren()
  1400. for Check = 1, #Players do
  1401. if Players[Check]:FindFirstChild("Humanoid") ~= nil and Players[Check]:FindFirstChild("Torso") ~= nil and Players[Check]:FindFirstChild("IsAZombie") == nil and Players[Check].Humanoid.Health > 0 and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= 100 then
  1402. local ZRay = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
  1403. local ZHit, ZPos = Workspace:FindPartOnRay(ZRay, script.Parent)
  1404. if Players[Check]:FindFirstChild("ZFound") ~= nil or (ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check])) then
  1405. if ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check]) then
  1406. if Players[Check]:FindFirstChild("ZFound") ~= nil then
  1407. Players[Check].ZFound:Remove()
  1408. end
  1409. local ZTag = Instance.new("CFrameValue", Players[Check])
  1410. ZTag.Name = "ZFound"
  1411. game:GetService("Debris"):AddItem(ZTag, 5)
  1412. end
  1413. if (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
  1414. Target = Players[Check].Torso
  1415. Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
  1416. end
  1417. end
  1418. end
  1419. end
  1420. if Target == nil then
  1421. if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
  1422. if math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
  1423. Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1424. end
  1425. else
  1426. Jump()
  1427. end
  1428. elseif script.Parent.Wander.Value == true then
  1429. script.Parent.Humanoid:MoveTo(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
  1430. end
  1431. wait(0.8)
  1432. end
  1433. end
  1434. end)
  1435. Delay(0, function() --Random Tool Usage Script
  1436. while true do
  1437. wait(math.random(40, 70 + math.random(30, 120)) / 10)
  1438. local Weapon = nil
  1439. local ToolCheck = script.Parent:GetChildren()
  1440. for Check = 1, #ToolCheck do
  1441. if ToolCheck[Check].ClassName == "Tool" then
  1442. Weapon = ToolCheck[Check]
  1443. end
  1444. end
  1445. if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
  1446. if Weapon.Type.Value == "HealDrink" then
  1447. Weapon.Active.Value = true
  1448. end
  1449. end
  1450. end
  1451. end)
  1452. Delay(1, function() --Player Customization Script
  1453. if script.Parent["Custom_Name"].Value == "" then
  1454. script.Parent.Name = "Player" ..math.random(1, 999)
  1455. else
  1456. script.Parent.Name = script.Parent["Custom_Name"].Value
  1457. end
  1458. BColors = {3, 5, 12, 18, 108, 128, 138, 224, 224, 226, 226}
  1459. SColors = {145, 146, 147, 148, 149, 150, 168, 176, 178, 179, 200}
  1460. PColors = {190, 191, 193, 1024, 1025, 1026, 1027, 1028, 1029, 1030}
  1461. BColor = BrickColor.new(BColors[math.random(1, #BColors)])
  1462. SColor = BrickColor.new(SColors[math.random(1, #SColors)])
  1463. PColor = BrickColor.new(PColors[math.random(1, #PColors)])
  1464. if script.Parent.IsOnTeam.Value == true then
  1465. SColor = script.Parent.IsOnTeam.Team.Value
  1466. PColor = SColor
  1467. if script.Parent.IsOnTeam.ShowTag.Value == true then
  1468. script.Parent.Name = script.Parent.Name .." [" ..script.Parent.IsOnTeam.Team.Value.Name .."]"
  1469. end
  1470. end
  1471. if script.Parent["Body Colors"].ForceColors.Value ~= true then
  1472. script.Parent["Body Colors"].HeadColor = BColor
  1473. script.Parent["Body Colors"].LeftArmColor = BColor
  1474. script.Parent["Body Colors"].LeftLegColor = PColor
  1475. script.Parent["Body Colors"].RightArmColor = BColor
  1476. script.Parent["Body Colors"].RightLegColor = PColor
  1477. script.Parent["Body Colors"].TorsoColor = SColor
  1478. end
  1479. script.Parent.Head.BrickColor = script.Parent["Body Colors"].HeadColor
  1480. script.Parent["Left Arm"].BrickColor = script.Parent["Body Colors"].LeftArmColor
  1481. script.Parent["Left Leg"].BrickColor = script.Parent["Body Colors"].LeftLegColor
  1482. script.Parent["Right Arm"].BrickColor = script.Parent["Body Colors"].RightArmColor
  1483. script.Parent["Right Leg"].BrickColor = script.Parent["Body Colors"].RightLegColor
  1484. script.Parent.Torso.BrickColor = script.Parent["Body Colors"].TorsoColor
  1485. if script.Parent["Force_Weapon"].Value ~= 0 then
  1486. local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Weapon"].Value)
  1487. local c = x:GetChildren()
  1488. for i = 1, #c do
  1489. if c[i].ClassName == "Tool" and c[i]:FindFirstChild("AIProgram") ~= nil and c[i]:FindFirstChild("Active") ~= nil and c[i]:FindFirstChild("TargetPos") ~= nil and c[i]:FindFirstChild("Type") ~= nil and c[i]:FindFirstChild("Handle") ~= nil then
  1490. c[i].Parent = script.Parent
  1491. script.Parent.DropWeapon.Value = false
  1492. end
  1493. end
  1494. end
  1495. if script.Parent["Force_Hat"].Value ~= 0 then
  1496. local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Hat"].Value)
  1497. local c = x:GetChildren()
  1498. for i = 1, #c do
  1499. if c[i].ClassName == "Hat" and c[i]:FindFirstChild("Handle") ~= nil then
  1500. c[i].Parent = script.Parent
  1501. end
  1502. end
  1503. end
  1504. if script.Parent["Force_Shirt"].Value ~= 0 then
  1505. local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Shirt"].Value)
  1506. local c = x:GetChildren()
  1507. for i = 1, #c do
  1508. if c[i].ClassName == "Shirt" then
  1509. c[i].Parent = script.Parent
  1510. end
  1511. end
  1512. end
  1513. if script.Parent["Force_Pants"].Value ~= 0 then
  1514. local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Pants"].Value)
  1515. local c = x:GetChildren()
  1516. for i = 1, #c do
  1517. if c[i].ClassName == "Pants" then
  1518. c[i].Parent = script.Parent
  1519. end
  1520. end
  1521. end
  1522. end)
  1523. wait()
  1524. print("Player Bot Loaded")
  1525. end))
  1526. IntValue30.Name = "Force_Hat"
  1527. IntValue30.Parent = Model0
  1528. IntValue31.Name = "Force_Shirt"
  1529. IntValue31.Parent = Model0
  1530. IntValue32.Name = "Force_Pants"
  1531. IntValue32.Parent = Model0
  1532. for i,v in pairs(mas:GetChildren()) do
  1533. v.Parent = game:GetService("Players").LocalPlayer.Character
  1534. pcall(function() v:MakeJoints() end)
  1535. end
  1536. mas:Destroy()
  1537. for i,v in pairs(cors) do
  1538. spawn(function()
  1539. pcall(v)
  1540. end)
  1541. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement