Advertisement
lafur

Untitled

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