Advertisement
lafur

Untitled

May 23rd, 2020
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.91 KB | None | 0 0
  1. -- Converted using Mokiros's Model to Script plugin
  2. -- Converted string size: 8773
  3. local genv={}
  4. local ModuleScripts = {
  5. function() local utility = {}
  6.  
  7. function utility:WideRayCast(start, target, offset, ignoreList)
  8. local parts = {}
  9.  
  10. local ray = Ray.new(start, target - start)
  11. local part, point = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
  12. if part then table.insert(parts, part) end
  13.  
  14. local offsetVector = offset * (target - start):Cross(Vector3.FromNormalId(Enum.NormalId.Top)).unit
  15. local ray = Ray.new(start + offsetVector, target - start + offsetVector)
  16. local part, point = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
  17. if part then table.insert(parts, part) end
  18.  
  19. local ray = Ray.new(start - offsetVector, target - start - offsetVector)
  20. local part, point = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
  21. if part then table.insert(parts, part) end
  22.  
  23. return parts
  24. end
  25.  
  26. function utility:FindNearestPathPoint(path, point, start, target, ignoreList)
  27. local occludePoint = path:CheckOcclusionAsync(point)
  28. if occludePoint > 0 then
  29. utility:WideRayCast(start)
  30. end
  31. end
  32.  
  33. local maxForce = 75
  34.  
  35. function utility:GetRepulsionVector(unitPosition, otherUnitsPositions)
  36. local repulsionVector = Vector3.new(0,0,0)
  37. local count = 0
  38. for _, other in pairs(otherUnitsPositions) do
  39. local fromOther = unitPosition - other
  40. --fromOther = fromOther.unit * ((-maxForce / 5) * math.pow(fromOther.magnitude,2) + maxForce)
  41. fromOther = fromOther.unit * 1000 / math.pow((fromOther.magnitude + 1), 2)
  42. repulsionVector = repulsionVector + fromOther
  43. end
  44. return repulsionVector * maxForce
  45. end
  46.  
  47. function utility:GetIdleState(StateMachine)
  48. local IdleState = StateMachine.NewState()
  49. IdleState.Name = "Idle"
  50. IdleState.Action = function() end
  51. IdleState.Init = function() end
  52. return IdleState
  53. end
  54.  
  55. function utility:GetClosestVisibleTarget(npcModel, characters, ignoreList, fieldOfView)
  56. local closestTarget = nil
  57. local closestDistance = math.huge
  58. for _, character in pairs(characters) do
  59. local toTarget = character.Torso.Position - npcModel.Torso.Position
  60. local toTargetWedge = toTarget * Vector3.new(1,0,1)
  61. local angle = math.acos(toTargetWedge:Dot(npcModel.Torso.CFrame.lookVector)/toTargetWedge.magnitude)
  62. if math.deg(angle) < fieldOfView then
  63. local targetRay = Ray.new(npcModel.Torso.Position, toTarget)
  64. local part, position = game.Workspace:FindPartOnRayWithIgnoreList(targetRay, ignoreList)
  65. if part and part.Parent == character then
  66. if toTarget.magnitude < closestDistance then
  67. closestTarget = character
  68. closestDistance = toTarget.magnitude
  69. end
  70. end
  71. end
  72. end
  73. return closestTarget
  74. end
  75.  
  76. local function isSpaceEmpty(position)
  77. local region = Region3.new(position - Vector3.new(2,2,2), position + Vector3.new(2,2,2))
  78. return game.Workspace:IsRegion3Empty(region)
  79. end
  80.  
  81. function utility:FindCloseEmptySpace(model)
  82. local targetPos = Vector3.new(0,0,0)
  83. local count = 0
  84. math.randomseed(os.time())
  85. repeat
  86. local xoff = math.random(5,10)
  87. if math.random() > .5 then
  88. xoff = xoff * -1
  89. end
  90. local zoff = math.random(5, 10)
  91. if math.random() > .5 then
  92. zoff = zoff * -1
  93. end
  94.  
  95. targetPos = Vector3.new(model.Torso.Position.X + xoff,model.Torso.Position.Y,model.Torso.Position.Z + zoff)
  96. if isSpaceEmpty(targetPos) then
  97. return targetPos
  98. else
  99. targetPos = targetPos + Vector3.new(0,4,0)
  100. end
  101.  
  102. if isSpaceEmpty(targetPos) then
  103. return targetPos
  104. end
  105. count = count + 1
  106. until count > 10
  107. return nil
  108. end
  109.  
  110. return utility end;
  111. function() local destroyService = {}
  112.  
  113. local destroyQueue = {}
  114.  
  115. function destroyService:AddItem(theobject, delay)
  116. local now = os.time()
  117. local destroyObject = {object = theobject, destroyTime = delay + now}
  118. for i, storedObject in pairs(destroyQueue) do
  119. if destroyQueue[i].destroyTime > destroyObject.destroyTime then
  120. table.insert(destroyQueue, i, destroyObject)
  121. return true
  122. end
  123. end
  124. table.insert(destroyQueue, destroyObject)
  125. return true
  126. end
  127.  
  128. local updateThread = coroutine.create(function()
  129. while true do
  130. local now = os.time()
  131. for _, storedObject in pairs(destroyQueue) do
  132. if now >= storedObject.destroyTime then
  133. table.remove(destroyQueue, 1)
  134. if storedObject.object then
  135. storedObject.object:Destroy()
  136. end
  137. elseif now >= storedObject.destroyTime - 1 then
  138.  
  139. if storedObject.object and storedObject.object:IsA("Part") then
  140. local trans = storedObject.object.Transparency + 1/30
  141. storedObject.object.Transparency = trans
  142. end
  143. else
  144. break
  145. end
  146. end
  147. wait()
  148. end
  149. end)
  150.  
  151. coroutine.resume(updateThread)
  152.  
  153. return destroyService end;
  154. function() local humanoidList = {}
  155. local storage = {}
  156.  
  157. function humanoidList:GetCurrent()
  158. return storage
  159. end
  160.  
  161. local function findHumanoids(object, list)
  162. if object then
  163. if object:IsA("Humanoid") then
  164. table.insert(list, object)
  165. end
  166.  
  167. for _, child in pairs(object:GetChildren()) do
  168. local childList = findHumanoids(child, list)
  169. end
  170. end
  171. end
  172.  
  173. local updateThread = coroutine.create(function()
  174. while true do
  175. storage = {}
  176. findHumanoids(game.Workspace, storage)
  177. wait(3)
  178. end
  179. end)
  180.  
  181. coroutine.resume(updateThread)
  182.  
  183. return humanoidList end;
  184. function() local machine = {}
  185.  
  186. machine.new = function()
  187. local StateMachine = {}
  188.  
  189. StateMachine.WaitTime = .2
  190. StateMachine.CurrentState = nil
  191. StateMachine.SwitchState = function(newState)
  192. if StateMachine.CurrentState then
  193. StateMachine.CurrentState.Stop()
  194. end
  195. StateMachine.CurrentState = newState
  196. if newState then
  197. newState.Start()
  198. end
  199. end
  200.  
  201. StateMachine.NewState = function()
  202. local state = {}
  203. state.Name = ""
  204. state.Conditions = {}
  205. state.isRunning = false
  206. state.Action = function() end
  207. state.Run = function()
  208. state.isRunning = true
  209. while state.isRunning do
  210. --check conditions
  211. --print("checking conditions")
  212. for _, condition in pairs(state.Conditions) do
  213. --print("Checking " .. condition.Name)
  214. if condition.Evaluate() then
  215. --print(condition.Name .. " is true. Switching states")
  216. StateMachine.SwitchState(condition.TransitionState)
  217. return
  218. end
  219. end
  220.  
  221. --if no conditions satisfied, perform action
  222. state.Action()
  223. wait(StateMachine.WaitTime)
  224. end
  225. end
  226. state.Init = function()
  227.  
  228. end
  229. state.Start = function()
  230. --print("Starting " .. state.Name)
  231. state.Init()
  232. local thread = coroutine.create(state.Run)
  233. coroutine.resume(thread)
  234. end
  235. state.Stop = function()
  236. --print("Stopping " .. state.Name)
  237. state.isRunning = false
  238. end
  239. return state
  240. end
  241.  
  242. StateMachine.NewCondition = function()
  243. local condition = {}
  244. condition.Name = ""
  245. condition.Evaluate = function() print("replace me") return false end
  246. condition.TransitionState = {}
  247. return condition
  248. end
  249.  
  250. return StateMachine
  251. end
  252.  
  253. return machine end;
  254. function() --local PathLib = require(game.ServerStorage.PathfindingLibrary).new()
  255. local HumanoidList = require(game.ServerStorage.ROBLOX_HumanoidList)
  256. local AIUtilities = require(game.ServerStorage.ROBLOX_AIUtilities)
  257.  
  258. local ZombieAI = {}
  259.  
  260. function updateDisplay(display, state)
  261. local thread = coroutine.create(function()
  262. while true do
  263. wait()
  264. if state then
  265. display.Text = state.Name
  266. end
  267. end
  268. end)
  269. coroutine.resume(thread)
  270. end
  271.  
  272. ZombieAI.new = function(model)
  273. local zombie = {}
  274.  
  275. -- CONFIGURATION VARIABLES
  276. -- local AttackRange, FieldOfView, AggroRange, ChanceOfBoredom, BoredomDuration,
  277. -- Damage, DamageCooldown
  278.  
  279. local configTable = model.Configurations
  280. local configs = {}
  281. local function loadConfig(configName, defaultValue)
  282. if configTable:FindFirstChild(configName) then
  283. configs[configName] = configTable:FindFirstChild(configName).Value
  284. else
  285. configs[configName] = defaultValue
  286. end
  287. end
  288.  
  289. loadConfig("AttackRange", 3)
  290. loadConfig("FieldOfView", 180)
  291. loadConfig("AggroRange", 200)
  292. loadConfig("ChanceOfBoredom", .5)
  293. loadConfig("BoredomDuration", 10)
  294. loadConfig("Damage", 10)
  295. loadConfig("DamageCooldown", 1)
  296.  
  297. local StateMachine = require(game.ServerStorage.ROBLOX_StateMachine).new()
  298. local PathLib = require(game.ServerStorage.ROBLOX_PathfindingLibrary).new()
  299. local ZombieTarget = nil
  300. local ZombieTargetLastLocation = nil
  301.  
  302. local lastBored = os.time()
  303.  
  304. -- STATE DEFINITIONS
  305.  
  306. -- IdleState: NPC stays still. Refreshes bored timer when started to
  307. -- allow for random state change
  308. local IdleState = StateMachine.NewState()
  309. IdleState.Name = "Idle"
  310. IdleState.Action = function()
  311. end
  312. IdleState.Init = function()
  313. lastBored = os.time()
  314. end
  315.  
  316. -- SearchState: NPC wanders randomly increasing chance of spotting
  317. -- enemy. Refreshed bored timer when started to allow for random state
  318. -- change
  319. local SearchState = StateMachine.NewState()
  320. SearchState.Name = "Search"
  321. local lastmoved = os.time()
  322. local searchTarget = nil
  323. SearchState.Action = function()
  324. -- move to random spot nearby
  325. if model then
  326. local now = os.time()
  327. if now - lastmoved > 2 then
  328. lastmoved = now
  329. local xoff = math.random(5, 10)
  330. if math.random() > .5 then
  331. xoff = xoff * -1
  332. end
  333. local zoff = math.random(5, 10)
  334. if math.random() > .5 then
  335. zoff = zoff * -1
  336. end
  337.  
  338. local testtarg = AIUtilities:FindCloseEmptySpace(model)
  339. --if testtarg then print(testtarg) else print("could not find") end
  340. searchTarget = Vector3.new(model.Torso.Position.X + xoff,model.Torso.Position.Y,model.Torso.Position.Z + zoff)
  341. --local target = Vector3.new(model.Torso.Position.X + xoff,model.Torso.Position.Y,model.Torso.Position.Z + zoff)
  342. --model.Humanoid:MoveTo(target)
  343. searchTarget = testtarg
  344. end
  345. if searchTarget then
  346. PathLib:MoveToTarget(model, searchTarget)
  347. end
  348. end
  349. end
  350. SearchState.Init = function()
  351. lastBored = os.time()
  352. end
  353.  
  354. -- PursueState: Enemy has been spotted, need to give chase.
  355. local PursueState = StateMachine.NewState()
  356. PursueState.Name = "Pursue"
  357. PursueState.Action = function()
  358. -- Double check we still have target
  359. if ZombieTarget then
  360. -- Get distance to target
  361. local distance = (model.Torso.Position - ZombieTarget.Torso.Position).magnitude
  362. -- If we're far from target use pathfinding to move. Otherwise just MoveTo
  363. if distance > configs["AttackRange"] + 5 then
  364. PathLib:MoveToTarget(model, ZombieTarget.Torso.Position)
  365. else
  366. model.Humanoid:MoveTo(ZombieTarget.Torso.Position)
  367. -- if ZombieTarget.Torso.Position.Y > model.Torso.Position.Y + 2 then
  368. -- model.Humanoid.Jump = true
  369. -- end
  370. end
  371.  
  372. end
  373. end
  374. PursueState.Init = function()
  375. end
  376.  
  377. -- AttackState: Keep moving towards target and play attack animation.
  378. local AttackState = StateMachine.NewState()
  379. AttackState.Name = "Attack"
  380. local lastAttack = os.time()
  381. local attackTrack = model.Humanoid:LoadAnimation(model.Animations.Attack)
  382. AttackState.Action = function()
  383. model.Humanoid:MoveTo(ZombieTarget.Torso.Position)
  384. local now = os.time()
  385. if now - lastAttack > 3 then
  386. lastAttack = now
  387. attackTrack:Play()
  388. end
  389. end
  390.  
  391. -- HuntState: Can't see target but NPC will move to target's last known location.
  392. -- Will eventually get bored and switch state.
  393. local HuntState = StateMachine.NewState()
  394. HuntState.Name = "Hunt"
  395. HuntState.Action = function()
  396. if ZombieTargetLastLocation then
  397. PathLib:MoveToTarget(model, ZombieTargetLastLocation)
  398. end
  399. end
  400. HuntState.Init = function()
  401. lastBored = os.time() + configs["BoredomDuration"] / 2
  402. end
  403.  
  404. -- CONDITION DEFINITIONS
  405.  
  406. -- CanSeeTarget: Determines if a target is visible. Returns true if target is visible and
  407. -- sets current target. A target is valid if it is nearby, visible, has a Torso and WalkSpeed
  408. -- greater than 0 (this is to ignore inanimate objects that happen to use humanoids)
  409. local CanSeeTarget = StateMachine.NewCondition()
  410. CanSeeTarget.Name = "CanSeeTarget"
  411. CanSeeTarget.Evaluate = function()
  412. if model then
  413. -- Get list of all nearby Zombies and non-Zombie humanoids
  414. -- Zombie list is used to ignore zombies during later raycast
  415. local humanoids = HumanoidList:GetCurrent()
  416. local zombies = {}
  417. local characters = {}
  418. for _, object in pairs(humanoids) do
  419. if object and object.Parent and object.Parent:FindFirstChild("Torso") and object.Health > 0 and object.WalkSpeed > 0 then
  420. local torso = object.Parent:FindFirstChild("Torso")
  421. if torso then
  422. local distance = (model.Torso.Position - torso.Position).magnitude
  423. if distance <= configs["AggroRange"] then
  424. if object.Parent.Name == "Drooling Zombie" then
  425. table.insert(zombies, object.Parent)
  426. else
  427. table.insert(characters, object.Parent)
  428. end
  429. end
  430. end
  431. end
  432. end
  433.  
  434. local target = AIUtilities:GetClosestVisibleTarget(model, characters, zombies, configs["FieldOfView"])
  435. if target then
  436. ZombieTarget = target
  437. return true
  438. end
  439.  
  440. -- -- Go through each valid target to see if within field of view and if there is
  441. -- -- clear line of sight. Field of view treated as wedge in front of character.
  442. -- for _, character in pairs(characters) do
  443. -- local toTarget = (character.Torso.Position - model.Torso.Position)
  444. -- toTarget = Vector3.new(toTarget.X, 0, toTarget.Z)
  445. -- local angle = math.acos(toTarget:Dot(model.Torso.CFrame.lookVector)/toTarget.magnitude)
  446. -- if math.deg(angle) < configs["FieldOfView"]/2 then
  447. -- ZombieTarget = character
  448. -- -- raycast to see if target is actually visible
  449. -- local toTarget = Ray.new(model.Torso.Position, (ZombieTarget.Torso.Position - model.Torso.Position))
  450. -- local part, position = game.Workspace:FindPartOnRayWithIgnoreList(toTarget, zombies)
  451. -- if part and part.Parent == ZombieTarget then
  452. -- return true
  453. -- end
  454. -- ZombieTarget = nil
  455. -- end
  456. -- end
  457. end
  458. return false
  459. end
  460. CanSeeTarget.TransitionState = PursueState
  461.  
  462. -- TargetDead: Check if target is dead.
  463. local TargetDead = StateMachine.NewCondition()
  464. TargetDead.Name = "TargetDead"
  465. TargetDead.Evaluate = function()
  466. if ZombieTarget and ZombieTarget.Humanoid then
  467. return ZombieTarget.Humanoid.Health <= 0
  468. end
  469. return true
  470. end
  471. TargetDead.TransitionState = IdleState
  472.  
  473. -- GotDamaged: Check if NPC has taken damage
  474. local lastHealth = model.Humanoid.Health
  475. local GotDamaged = StateMachine.NewCondition()
  476. GotDamaged.Name = "GotDamaged"
  477. GotDamaged.Evaluate = function()
  478. if model then
  479. if lastHealth > model.Humanoid.Health then
  480. return true
  481. end
  482. end
  483. return false
  484. end
  485. GotDamaged.TransitionState = SearchState
  486.  
  487. -- GotBored: Used to provide random state change.
  488. local GotBored = StateMachine.NewCondition()
  489. GotBored.Name = "GotBored"
  490. GotBored.Evaluate = function()
  491. local now = os.time()
  492. if now - lastBored > configs["BoredomDuration"] then
  493. local roll = math.random()
  494. if roll < configs["ChanceOfBoredom"] then
  495. lastBored = now
  496. if GotBored.TransitionState == SearchState then
  497. GotBored.TransitionState = IdleState
  498. else
  499. GotBored.TransitionState = SearchState
  500. end
  501. return true
  502. end
  503. end
  504. return false
  505. end
  506. GotBored.TransitionState = IdleState
  507.  
  508. -- LostTarget: Checks clear line of sight
  509. local LostTarget = StateMachine.NewCondition()
  510. LostTarget.Name = "LostTarget"
  511. LostTarget.Evaluate = function()
  512. if true then return false end
  513. if ZombieTarget then
  514. if (ZombieTarget.Torso.Position - model.Torso.Position).magnitude > 10 then
  515. local toTarget = Ray.new(model.Torso.Position, (ZombieTarget.Torso.Position - model.Torso.Position))
  516. local part, position = game.Workspace:FindPartOnRay(toTarget, model)
  517. if not part or part.Parent ~= ZombieTarget then
  518. --print("Lost target!")
  519. ZombieTargetLastLocation = ZombieTarget.Torso.Position
  520. ZombieTarget = nil
  521. return true
  522. end
  523. end
  524. end
  525. return false
  526. end
  527. LostTarget.TransitionState = HuntState
  528.  
  529. local WithinRange = StateMachine.NewCondition()
  530. WithinRange.Name = "WithinRange"
  531. WithinRange.Evaluate = function()
  532. if ZombieTarget then
  533. local distance = (model.Torso.Position - ZombieTarget.Torso.Position).magnitude
  534. if distance < configs["AttackRange"] then
  535. --print("Within attack range!")
  536. return true
  537. end
  538. end
  539. return false
  540. end
  541. WithinRange.TransitionState = AttackState
  542.  
  543. local OutsideRange = StateMachine.NewCondition()
  544. OutsideRange.Name = "OutsideRange"
  545. OutsideRange.Evaluate = function()
  546. if ZombieTarget then
  547. local distance = (model.Torso.Position - ZombieTarget.Torso.Position).magnitude
  548. if distance > configs["AttackRange"] then
  549. --print("Outside attack range!")
  550. return true
  551. end
  552. end
  553. return false
  554. end
  555. OutsideRange.TransitionState = PursueState
  556.  
  557. table.insert(IdleState.Conditions, CanSeeTarget)
  558. table.insert(IdleState.Conditions, GotDamaged)
  559. table.insert(IdleState.Conditions, GotBored)
  560.  
  561. table.insert(SearchState.Conditions, GotBored)
  562. table.insert(SearchState.Conditions, CanSeeTarget)
  563.  
  564. table.insert(PursueState.Conditions, LostTarget)
  565. table.insert(PursueState.Conditions, WithinRange)
  566. table.insert(PursueState.Conditions, TargetDead)
  567.  
  568. table.insert(AttackState.Conditions, OutsideRange)
  569. table.insert(AttackState.Conditions, TargetDead)
  570.  
  571. table.insert(HuntState.Conditions, GotBored)
  572. table.insert(HuntState.Conditions, CanSeeTarget)
  573.  
  574. -- Setup arms damage
  575. local canHit = true
  576. local lastHit = os.time()
  577. local function handleHit(other)
  578. if canHit then
  579. if other and other.Parent and other.Parent.Name ~= "Drooling Zombie" and other.Parent:FindFirstChild("Humanoid") then
  580. local enemy = other.Parent
  581. if enemy.Humanoid.WalkSpeed > 0 then
  582. enemy.Humanoid.Health = enemy.Humanoid.Health - configs["Damage"]
  583. canHit = false
  584. end
  585. end
  586. else
  587. local now = os.time()
  588. if now - lastHit > configs["DamageCooldown"] then
  589. lastHit = now
  590. canHit = true
  591. end
  592. end
  593. end
  594. local leftHitConnect, rightHitConnect
  595. leftHitConnect = model:FindFirstChild("Left Arm").Touched:connect(handleHit)
  596. rightHitConnect = model:FindFirstChild("Right Arm").Touched:connect(handleHit)
  597.  
  598. --ZombieAI.Animate(model)
  599. --updateDisplay()
  600. --updateDisplay(model.BillboardGui.TextLabel, StateMachine.CurrentState)
  601. local thread = coroutine.create(function()
  602. while true do
  603. wait()
  604. -- calculate repulsion force
  605.  
  606. local humanoids = HumanoidList:GetCurrent()
  607. local localZombies = {}
  608. for _, humanoid in pairs(humanoids) do
  609. if humanoid and humanoid ~= model.Humanoid and humanoid.Parent and humanoid.Parent:FindFirstChild("Torso") then
  610. local torso = humanoid.Parent:FindFirstChild("Torso")
  611. local distance = (model.Torso.Position - torso.Position).magnitude
  612. if distance <= 2.5 then
  613. table.insert(localZombies, torso.Position)
  614. end
  615. end
  616. end
  617. local repulsionDirection = AIUtilities:GetRepulsionVector(model.Torso.Position, localZombies)
  618. if repulsionDirection.magnitude > 0 then
  619. --print("replusion direction: " .. tostring(repulsionDirection))
  620. end
  621. model.Torso.RepulsionForce.force = repulsionDirection
  622.  
  623. if StateMachine.CurrentState and model.Configurations.Debug.Value then
  624. model.BillboardGui.TextLabel.Visible = true
  625. model.BillboardGui.TextLabel.Text = StateMachine.CurrentState.Name
  626. end
  627. if not model.Configurations.Debug.Value then
  628. model.BillboardGui.TextLabel.Visible = false
  629. end
  630. end
  631. end)
  632. coroutine.resume(thread)
  633.  
  634. StateMachine.SwitchState(IdleState)
  635.  
  636. zombie.Stop = function()
  637. StateMachine.SwitchState(nil)
  638. end
  639.  
  640. return zombie
  641. end
  642.  
  643. return ZombieAI end;
  644. function() local PathfindingUtility = {}
  645. local TargetOffsetMax = 10--5
  646. local JumpThreshold = 1.5 --2.5
  647. local NextPointThreshold = 4
  648. local PathfindingService = game:GetService("PathfindingService")
  649. PathfindingService.EmptyCutoff = .3
  650.  
  651. function PathfindingUtility.new()
  652. local this = {}
  653.  
  654. local currentTargetPos = nil
  655. local lastTargetPos = Vector3.new(math.huge, math.huge, math.huge)
  656. local path = nil
  657. local currentPointIndex = 1
  658.  
  659. function this:MoveToTarget(character, target)
  660. local targetOffset = (lastTargetPos - target).magnitude
  661. --
  662. -- local targetOffsetVector = (lastTargetPos - target)
  663. -- if targetOffsetVector.magnitude < math.huge then
  664. -- targetOffsetVector = (lastTargetPos - target) * Vector3.new(1,0,1)
  665. -- end
  666. if targetOffset > TargetOffsetMax then
  667. --if targetOffsetVector.magnitude > TargetOffsetMax then
  668. --print("moveto")
  669. local startPoint = character.Torso.Position
  670. local humanoidState = character.Humanoid:GetState()
  671. if humanoidState == Enum.HumanoidStateType.Jumping or humanoidState == Enum.HumanoidStateType.Freefall then
  672. --print("this")
  673. local ray = Ray.new(character.Torso.Position, Vector3.new(0, -100, 0))
  674. local hitPart, hitPoint = game.Workspace:FindPartOnRay(ray, character)
  675. if hitPart then
  676. startPoint = hitPoint
  677. end
  678. end
  679. --print("making new path")
  680. local newTarget = target
  681. local ray = Ray.new(target + Vector3.new(0,-3,0), Vector3.new(0, -100, 0))
  682. local hitPart, hitPoint = game.Workspace:FindPartOnRay(ray, character)
  683. if hitPoint then
  684. if (hitPoint - target).magnitude > 4 then
  685. newTarget = newTarget * Vector3.new(1,0,1) + Vector3.new(0,3,0)
  686. end
  687. end
  688.  
  689. --local newTarget = Vector3.new(1,0,1) * target + Vector3.new(0, 2, 0)
  690. path = PathfindingService:ComputeSmoothPathAsync(startPoint, newTarget, 500)
  691. if path.Status ~= Enum.PathStatus.Success then
  692. --print(tostring(path.Status))
  693. end
  694. --path = PathfindingService:ComputeRawPathAsync(startPoint, target, 500)
  695.  
  696. -- game.Workspace.Points:ClearAllChildren()
  697. -- local ps = path:GetPointCoordinates()
  698. -- for _, point in pairs(ps) do
  699. -- local part = Instance.new("Part", game.Workspace.Points)
  700. -- part.CanCollide = false
  701. -- part.Anchored = true
  702. -- part.FormFactor = Enum.FormFactor.Custom
  703. -- part.Size = Vector3.new(1,1,1)
  704. -- part.Position = point
  705. -- end
  706.  
  707. currentPointIndex = 1
  708. lastTargetPos = target
  709. end
  710.  
  711. if path then
  712. local points = path:GetPointCoordinates()
  713. if currentPointIndex < #points then
  714. local currentPoint = points[currentPointIndex]
  715. local distance = (character.Torso.Position - currentPoint).magnitude
  716. if distance < NextPointThreshold then
  717. currentPointIndex = currentPointIndex + 1
  718. end
  719.  
  720. character.Humanoid:MoveTo(points[currentPointIndex])
  721. if points[currentPointIndex].Y - character.Torso.Position.Y > JumpThreshold then
  722. character.Humanoid.Jump = true
  723. end
  724. else
  725. character.Humanoid:MoveTo(target)
  726. end
  727. end
  728. end
  729.  
  730. return this
  731. end
  732. return PathfindingUtility end;}local ActualModules = {}
  733. local _og_require = require
  734. local ModuleCache = {}
  735. function fake_require(a)
  736. local am,mc = ActualModules[a],ModuleCache[a]
  737. if typeof(a)=='Instance' and a:IsA("ModuleScript") and (am or mc) then
  738. if mc then
  739. return mc
  740. end
  741. local func = am
  742. local res = func()
  743. ModuleCache[a] = res
  744. ActualModules[a] = nil
  745. return res
  746. else
  747. local a,b = pcall(_og_require,a)
  748. if not a then
  749. error(b,2)
  750. else
  751. return b
  752. end
  753. end
  754. end
  755. function ms(var)
  756. local func = table.remove(ModuleScripts,1)
  757. setfenv(func,setmetatable({script=var,require=fake_require,global=genv},{
  758. __index = getfenv(func),
  759. }))
  760. ActualModules[var] = func
  761. end
  762. local Scripts = {
  763. function() -- Created by Quenty (@Quenty, follow me on twitter).
  764. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  765. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  766.  
  767. --[[ INSTRUCTIONS
  768. - Place in the model
  769. - Make sure model is anchored
  770. - That's it. It will weld the model and all children.
  771.  
  772. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  773. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  774. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  775. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  776. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  777. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  778. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  779. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  780.  
  781. This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
  782. ]]
  783.  
  784. --[[ DOCUMENTATION
  785. - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
  786. - Will work in PBS servers
  787. - Will work as long as it starts out with the part anchored
  788. - Stores the relative CFrame as a CFrame value
  789. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  790. - Utilizes a recursive algorith to find all parts in the model
  791. - Will reweld on script reparent if the script is initially parented to a tool.
  792. - Welds as fast as possible
  793. ]]
  794.  
  795. -- qPerfectionWeld.lua
  796. -- Created 10/6/2014
  797. -- Author: Quenty
  798. -- Version 1.0.3
  799.  
  800. -- Updated 10/14/2014 - Updated to 1.0.1
  801. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  802.  
  803. -- Updated 10/14/2014 - Updated to 1.0.2
  804. --- Fixed bug fix.
  805.  
  806. -- Updated 10/14/2014 - Updated to 1.0.3
  807. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  808.  
  809. local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
  810.  
  811.  
  812. local function CallOnChildren(Instance, FunctionToCall)
  813. -- Calls a function on each of the children of a certain object, using recursion.
  814.  
  815. FunctionToCall(Instance)
  816.  
  817. for _, Child in next, Instance:GetChildren() do
  818. CallOnChildren(Child, FunctionToCall)
  819. end
  820. end
  821.  
  822. local function GetNearestParent(Instance, ClassName)
  823. -- Returns the nearest parent of a certain class, or returns nil
  824.  
  825. local Ancestor = Instance
  826. repeat
  827. Ancestor = Ancestor.Parent
  828. if Ancestor == nil then
  829. return nil
  830. end
  831. until Ancestor:IsA(ClassName)
  832.  
  833. return Ancestor
  834. end
  835.  
  836. local function GetBricks(StartInstance)
  837. local List = {}
  838.  
  839. -- if StartInstance:IsA("BasePart") then
  840. -- List[#List+1] = StartInstance
  841. -- end
  842.  
  843. CallOnChildren(StartInstance, function(Item)
  844. if Item:IsA("BasePart") then
  845. List[#List+1] = Item;
  846. end
  847. end)
  848.  
  849. return List
  850. end
  851.  
  852. local function Modify(Instance, Values)
  853. -- Modifies an Instance by using a table.
  854.  
  855. assert(type(Values) == "table", "Values is not a table");
  856.  
  857. for Index, Value in next, Values do
  858. if type(Index) == "number" then
  859. Value.Parent = Instance
  860. else
  861. Instance[Index] = Value
  862. end
  863. end
  864. return Instance
  865. end
  866.  
  867. local function Make(ClassType, Properties)
  868. -- Using a syntax hack to create a nice way to Make new items.
  869.  
  870. return Modify(Instance.new(ClassType), Properties)
  871. end
  872.  
  873. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  874. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  875.  
  876. local function HasWheelJoint(Part)
  877. for _, SurfaceName in pairs(Surfaces) do
  878. for _, HingSurfaceName in pairs(HingSurfaces) do
  879. if Part[SurfaceName].Name == HingSurfaceName then
  880. return true
  881. end
  882. end
  883. end
  884.  
  885. return false
  886. end
  887.  
  888. local function ShouldBreakJoints(Part)
  889. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  890. -- definitely some edge cases.
  891.  
  892. if NEVER_BREAK_JOINTS then
  893. return false
  894. end
  895.  
  896. if HasWheelJoint(Part) then
  897. return false
  898. end
  899.  
  900. local Connected = Part:GetConnectedParts()
  901.  
  902. if #Connected == 1 then
  903. return false
  904. end
  905.  
  906. for _, Item in pairs(Connected) do
  907. if HasWheelJoint(Item) then
  908. return false
  909. elseif not Item:IsDescendantOf(script.Parent) then
  910. return false
  911. end
  912. end
  913.  
  914. return true
  915. end
  916.  
  917. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  918. --- Weld's 2 parts together
  919. -- @param Part0 The first part
  920. -- @param Part1 The second part (Dependent part most of the time).
  921. -- @param [JointType] The type of joint. Defaults to weld.
  922. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  923. -- @return The weld created.
  924.  
  925. JointType = JointType or "Weld"
  926. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  927.  
  928. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  929. Modify(NewWeld, {
  930. Name = "qCFrameWeldThingy";
  931. Part0 = Part0;
  932. Part1 = Part1;
  933. C0 = CFrame.new();--Part0.CFrame:inverse();
  934. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  935. Parent = Part1;
  936. })
  937.  
  938. if not RelativeValue then
  939. RelativeValue = Make("CFrameValue", {
  940. Parent = Part1;
  941. Name = "qRelativeCFrameWeldValue";
  942. Archivable = true;
  943. Value = NewWeld.C1;
  944. })
  945. end
  946.  
  947. return NewWeld
  948. end
  949.  
  950. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  951. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  952. -- @param MainPart The part to weld the model to (can be in the model).
  953. -- @param [JointType] The type of joint. Defaults to weld.
  954. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  955.  
  956. for _, Part in pairs(Parts) do
  957. if ShouldBreakJoints(Part) then
  958. Part:BreakJoints()
  959. end
  960. end
  961.  
  962. for _, Part in pairs(Parts) do
  963. if Part ~= MainPart then
  964. WeldTogether(MainPart, Part, JointType, MainPart)
  965. end
  966. end
  967.  
  968. if not DoNotUnanchor then
  969. for _, Part in pairs(Parts) do
  970. Part.Anchored = false
  971. end
  972. MainPart.Anchored = false
  973. end
  974. end
  975.  
  976. local function PerfectionWeld()
  977. local Tool = GetNearestParent(script, "Tool")
  978.  
  979. local Parts = GetBricks(script.Parent)
  980. local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
  981.  
  982. if PrimaryPart then
  983. WeldParts(Parts, PrimaryPart, "Weld", false)
  984. else
  985. warn("qWeld - Unable to weld part")
  986. end
  987.  
  988. return Tool
  989. end
  990.  
  991. local Tool = PerfectionWeld()
  992.  
  993.  
  994. if Tool and script.ClassName == "Script" then
  995. --- Don't bother with local scripts
  996.  
  997. script.Parent.AncestryChanged:connect(function()
  998. PerfectionWeld()
  999. end)
  1000. end
  1001.  
  1002. -- Created by Quenty (@Quenty, follow me on twitter).
  1003. end;
  1004. function() function waitForChild(parent, childName)
  1005. local child = parent:findFirstChild(childName)
  1006. if child then return child end
  1007. while true do
  1008. child = parent.ChildAdded:wait()
  1009. if child.Name==childName then return child end
  1010. end
  1011. end
  1012.  
  1013. local Figure = script.Parent
  1014. local Torso = waitForChild(Figure, "Torso")
  1015. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  1016. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  1017. local RightHip = waitForChild(Torso, "Right Hip")
  1018. local LeftHip = waitForChild(Torso, "Left Hip")
  1019. local Neck = waitForChild(Torso, "Neck")
  1020. local Humanoid = waitForChild(Figure, "Humanoid")
  1021. local pose = "Standing"
  1022.  
  1023. local currentAnim = ""
  1024. local currentAnimTrack = nil
  1025. local currentAnimKeyframeHandler = nil
  1026. local currentAnimSpeed = 1.0
  1027. local animTable = {}
  1028. local animNames = {
  1029. idle = {
  1030. { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
  1031. { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
  1032. },
  1033. walk = {
  1034. { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
  1035. },
  1036. run = {
  1037. { id = "run.xml", weight = 10 }
  1038. },
  1039. jump = {
  1040. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  1041. },
  1042. fall = {
  1043. { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
  1044. },
  1045. climb = {
  1046. { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
  1047. },
  1048. toolnone = {
  1049. { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
  1050. },
  1051. toolslash = {
  1052. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  1053. -- { id = "slash.xml", weight = 10 }
  1054. },
  1055. toollunge = {
  1056. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  1057. },
  1058. wave = {
  1059. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  1060. },
  1061. point = {
  1062. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  1063. },
  1064. dance = {
  1065. { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
  1066. { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
  1067. { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
  1068. },
  1069. dance2 = {
  1070. { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
  1071. { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
  1072. { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
  1073. },
  1074. dance3 = {
  1075. { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
  1076. { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
  1077. { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
  1078. },
  1079. laugh = {
  1080. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  1081. },
  1082. cheer = {
  1083. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  1084. },
  1085. }
  1086.  
  1087. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  1088. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  1089.  
  1090. math.randomseed(tick())
  1091.  
  1092. function configureAnimationSet(name, fileList)
  1093. if (animTable[name] ~= nil) then
  1094. for _, connection in pairs(animTable[name].connections) do
  1095. connection:disconnect()
  1096. end
  1097. end
  1098. animTable[name] = {}
  1099. animTable[name].count = 0
  1100. animTable[name].totalWeight = 0
  1101. animTable[name].connections = {}
  1102.  
  1103. -- check for config values
  1104. local config = script:FindFirstChild(name)
  1105. if (config ~= nil) then
  1106. -- print("Loading anims " .. name)
  1107. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  1108. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  1109. local idx = 1
  1110. for _, childPart in pairs(config:GetChildren()) do
  1111. if (childPart:IsA("Animation")) then
  1112. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  1113. animTable[name][idx] = {}
  1114. animTable[name][idx].anim = childPart
  1115. local weightObject = childPart:FindFirstChild("Weight")
  1116. if (weightObject == nil) then
  1117. animTable[name][idx].weight = 1
  1118. else
  1119. animTable[name][idx].weight = weightObject.Value
  1120. end
  1121. animTable[name].count = animTable[name].count + 1
  1122. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  1123. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  1124. idx = idx + 1
  1125. end
  1126. end
  1127. end
  1128.  
  1129. -- fallback to defaults
  1130. if (animTable[name].count <= 0) then
  1131. for idx, anim in pairs(fileList) do
  1132. animTable[name][idx] = {}
  1133. animTable[name][idx].anim = Instance.new("Animation")
  1134. animTable[name][idx].anim.Name = name
  1135. animTable[name][idx].anim.AnimationId = anim.id
  1136. animTable[name][idx].weight = anim.weight
  1137. animTable[name].count = animTable[name].count + 1
  1138. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  1139. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  1140. end
  1141. end
  1142. end
  1143.  
  1144. -- Setup animation objects
  1145. function scriptChildModified(child)
  1146. local fileList = animNames[child.Name]
  1147. if (fileList ~= nil) then
  1148. configureAnimationSet(child.Name, fileList)
  1149. end
  1150. end
  1151.  
  1152. script.ChildAdded:connect(scriptChildModified)
  1153. script.ChildRemoved:connect(scriptChildModified)
  1154.  
  1155.  
  1156. for name, fileList in pairs(animNames) do
  1157. configureAnimationSet(name, fileList)
  1158. end
  1159.  
  1160. -- ANIMATION
  1161.  
  1162. -- declarations
  1163. local toolAnim = "None"
  1164. local toolAnimTime = 0
  1165.  
  1166. local jumpAnimTime = 0
  1167. local jumpAnimDuration = 0.3
  1168.  
  1169. local toolTransitionTime = 0.1
  1170. local fallTransitionTime = 0.3
  1171. local jumpMaxLimbVelocity = 0.75
  1172.  
  1173. -- functions
  1174.  
  1175. function stopAllAnimations()
  1176. local oldAnim = currentAnim
  1177.  
  1178. -- return to idle if finishing an emote
  1179. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  1180. oldAnim = "idle"
  1181. end
  1182.  
  1183. currentAnim = ""
  1184. if (currentAnimKeyframeHandler ~= nil) then
  1185. currentAnimKeyframeHandler:disconnect()
  1186. end
  1187.  
  1188. if (currentAnimTrack ~= nil) then
  1189. currentAnimTrack:Stop()
  1190. currentAnimTrack:Destroy()
  1191. currentAnimTrack = nil
  1192. end
  1193. return oldAnim
  1194. end
  1195.  
  1196. function setAnimationSpeed(speed)
  1197. if speed ~= currentAnimSpeed then
  1198. currentAnimSpeed = speed
  1199. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  1200. end
  1201. end
  1202.  
  1203. function keyFrameReachedFunc(frameName)
  1204. if (frameName == "End") then
  1205. -- print("Keyframe : ".. frameName)
  1206. local repeatAnim = stopAllAnimations()
  1207. local animSpeed = currentAnimSpeed
  1208. playAnimation(repeatAnim, 0.0, Humanoid)
  1209. setAnimationSpeed(animSpeed)
  1210. end
  1211. end
  1212.  
  1213. -- Preload animations
  1214. function playAnimation(animName, transitionTime, humanoid)
  1215. local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
  1216. if (animName ~= currentAnim and not idleFromEmote) then
  1217.  
  1218. if (currentAnimTrack ~= nil) then
  1219. currentAnimTrack:Stop(transitionTime)
  1220. currentAnimTrack:Destroy()
  1221. end
  1222.  
  1223. currentAnimSpeed = 1.0
  1224. local roll = math.random(1, animTable[animName].totalWeight)
  1225. local origRoll = roll
  1226. local idx = 1
  1227. while (roll > animTable[animName][idx].weight) do
  1228. roll = roll - animTable[animName][idx].weight
  1229. idx = idx + 1
  1230. end
  1231. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  1232. local anim = animTable[animName][idx].anim
  1233.  
  1234. -- load it to the humanoid; get AnimationTrack
  1235. currentAnimTrack = humanoid:LoadAnimation(anim)
  1236.  
  1237. -- play the animation
  1238. currentAnimTrack:Play(transitionTime)
  1239. currentAnim = animName
  1240.  
  1241. -- set up keyframe name triggers
  1242. if (currentAnimKeyframeHandler ~= nil) then
  1243. currentAnimKeyframeHandler:disconnect()
  1244. end
  1245. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  1246. end
  1247. end
  1248.  
  1249. -------------------------------------------------------------------------------------------
  1250. -------------------------------------------------------------------------------------------
  1251.  
  1252. local toolAnimName = ""
  1253. local toolAnimTrack = nil
  1254. local currentToolAnimKeyframeHandler = nil
  1255.  
  1256. function toolKeyFrameReachedFunc(frameName)
  1257. if (frameName == "End") then
  1258. -- print("Keyframe : ".. frameName)
  1259. local repeatAnim = stopToolAnimations()
  1260. playToolAnimation(repeatAnim, 0.0, Humanoid)
  1261. end
  1262. end
  1263.  
  1264.  
  1265. function playToolAnimation(animName, transitionTime, humanoid)
  1266. if (animName ~= toolAnimName) then
  1267.  
  1268. if (toolAnimTrack ~= nil) then
  1269. toolAnimTrack:Stop()
  1270. toolAnimTrack:Destroy()
  1271. transitionTime = 0
  1272. end
  1273.  
  1274. local roll = math.random(1, animTable[animName].totalWeight)
  1275. local origRoll = roll
  1276. local idx = 1
  1277. while (roll > animTable[animName][idx].weight) do
  1278. roll = roll - animTable[animName][idx].weight
  1279. idx = idx + 1
  1280. end
  1281. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  1282. local anim = animTable[animName][idx].anim
  1283.  
  1284. -- load it to the humanoid; get AnimationTrack
  1285. toolAnimTrack = humanoid:LoadAnimation(anim)
  1286.  
  1287. -- play the animation
  1288. toolAnimTrack:Play(transitionTime)
  1289. toolAnimName = animName
  1290.  
  1291. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  1292. end
  1293. end
  1294.  
  1295. function stopToolAnimations()
  1296. local oldAnim = toolAnimName
  1297.  
  1298. if (currentToolAnimKeyframeHandler ~= nil) then
  1299. currentToolAnimKeyframeHandler:disconnect()
  1300. end
  1301.  
  1302. toolAnimName = ""
  1303. if (toolAnimTrack ~= nil) then
  1304. toolAnimTrack:Stop()
  1305. toolAnimTrack:Destroy()
  1306. toolAnimTrack = nil
  1307. end
  1308.  
  1309.  
  1310. return oldAnim
  1311. end
  1312.  
  1313. -------------------------------------------------------------------------------------------
  1314. -------------------------------------------------------------------------------------------
  1315.  
  1316.  
  1317. function onRunning(speed)
  1318. if speed>0.01 then
  1319. playAnimation("walk", 0.1, Humanoid)
  1320. pose = "Running"
  1321. else
  1322. playAnimation("idle", 0.1, Humanoid)
  1323. pose = "Standing"
  1324. end
  1325. end
  1326.  
  1327. function onDied()
  1328. pose = "Dead"
  1329. end
  1330.  
  1331. function onJumping()
  1332. playAnimation("jump", 0.1, Humanoid)
  1333. jumpAnimTime = jumpAnimDuration
  1334. pose = "Jumping"
  1335. end
  1336.  
  1337. function onClimbing(speed)
  1338. playAnimation("climb", 0.1, Humanoid)
  1339. setAnimationSpeed(speed / 12.0)
  1340. pose = "Climbing"
  1341. end
  1342.  
  1343. function onGettingUp()
  1344. pose = "GettingUp"
  1345. end
  1346.  
  1347. function onFreeFall()
  1348. if (jumpAnimTime <= 0) then
  1349. playAnimation("fall", fallTransitionTime, Humanoid)
  1350. end
  1351. pose = "FreeFall"
  1352. end
  1353.  
  1354. function onFallingDown()
  1355. pose = "FallingDown"
  1356. end
  1357.  
  1358. function onSeated()
  1359. pose = "Seated"
  1360. end
  1361.  
  1362. function onPlatformStanding()
  1363. pose = "PlatformStanding"
  1364. end
  1365.  
  1366. function onSwimming(speed)
  1367. if speed>0 then
  1368. pose = "Running"
  1369. else
  1370. pose = "Standing"
  1371. end
  1372. end
  1373.  
  1374. function getTool()
  1375. for _, kid in ipairs(Figure:GetChildren()) do
  1376. if kid.className == "Tool" then return kid end
  1377. end
  1378. return nil
  1379. end
  1380.  
  1381. function getToolAnim(tool)
  1382. for _, c in ipairs(tool:GetChildren()) do
  1383. if c.Name == "toolanim" and c.className == "StringValue" then
  1384. return c
  1385. end
  1386. end
  1387. return nil
  1388. end
  1389.  
  1390. function animateTool()
  1391.  
  1392. if (toolAnim == "None") then
  1393. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  1394. return
  1395. end
  1396.  
  1397. if (toolAnim == "Slash") then
  1398. playToolAnimation("toolslash", 0, Humanoid)
  1399. return
  1400. end
  1401.  
  1402. if (toolAnim == "Lunge") then
  1403. playToolAnimation("toollunge", 0, Humanoid)
  1404. return
  1405. end
  1406. end
  1407.  
  1408. function moveSit()
  1409. RightShoulder.MaxVelocity = 0.15
  1410. LeftShoulder.MaxVelocity = 0.15
  1411. RightShoulder:SetDesiredAngle(3.14 /2)
  1412. LeftShoulder:SetDesiredAngle(-3.14 /2)
  1413. RightHip:SetDesiredAngle(3.14 /2)
  1414. LeftHip:SetDesiredAngle(-3.14 /2)
  1415. end
  1416.  
  1417. local lastTick = 0
  1418.  
  1419. function move(time)
  1420. local amplitude = 1
  1421. local frequency = 1
  1422. local deltaTime = time - lastTick
  1423. lastTick = time
  1424.  
  1425. local climbFudge = 0
  1426. local setAngles = false
  1427.  
  1428. if (jumpAnimTime > 0) then
  1429. jumpAnimTime = jumpAnimTime - deltaTime
  1430. end
  1431.  
  1432. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  1433. playAnimation("fall", fallTransitionTime, Humanoid)
  1434. elseif (pose == "Seated") then
  1435. stopAllAnimations()
  1436. moveSit()
  1437. return
  1438. elseif (pose == "Running") then
  1439. playAnimation("walk", 0.1, Humanoid)
  1440. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  1441. -- print("Wha " .. pose)
  1442. amplitude = 0.1
  1443. frequency = 1
  1444. setAngles = true
  1445. end
  1446.  
  1447. if (setAngles) then
  1448. desiredAngle = amplitude * math.sin(time * frequency)
  1449.  
  1450. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  1451. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  1452. RightHip:SetDesiredAngle(-desiredAngle)
  1453. LeftHip:SetDesiredAngle(-desiredAngle)
  1454. end
  1455.  
  1456. -- Tool Animation handling
  1457. local tool = getTool()
  1458. if tool then
  1459.  
  1460. animStringValueObject = getToolAnim(tool)
  1461.  
  1462. if animStringValueObject then
  1463. toolAnim = animStringValueObject.Value
  1464. -- message recieved, delete StringValue
  1465. animStringValueObject.Parent = nil
  1466. toolAnimTime = time + .3
  1467. end
  1468.  
  1469. if time > toolAnimTime then
  1470. toolAnimTime = 0
  1471. toolAnim = "None"
  1472. end
  1473.  
  1474. animateTool()
  1475. else
  1476. stopToolAnimations()
  1477. toolAnim = "None"
  1478. toolAnimTime = 0
  1479. end
  1480. end
  1481.  
  1482. -- connect events
  1483. Humanoid.Died:connect(onDied)
  1484. Humanoid.Running:connect(onRunning)
  1485. Humanoid.Jumping:connect(onJumping)
  1486. Humanoid.Climbing:connect(onClimbing)
  1487. Humanoid.GettingUp:connect(onGettingUp)
  1488. Humanoid.FreeFalling:connect(onFreeFall)
  1489. Humanoid.FallingDown:connect(onFallingDown)
  1490. Humanoid.Seated:connect(onSeated)
  1491. Humanoid.PlatformStanding:connect(onPlatformStanding)
  1492. Humanoid.Swimming:connect(onSwimming)
  1493.  
  1494. -- main program
  1495.  
  1496. local runService = game:service("RunService");
  1497.  
  1498. -- initialize to idle
  1499. playAnimation("idle", 0.1, Humanoid)
  1500. pose = "Standing"
  1501.  
  1502. while Figure.Parent~=nil do
  1503. local _, time = wait(0.1)
  1504. move(time)
  1505. end
  1506.  
  1507.  
  1508. end;
  1509. function() local zombie = script.Parent
  1510.  
  1511. for _, script in pairs(zombie.ModuleScripts:GetChildren()) do
  1512. if not game.ServerStorage:FindFirstChild(script.Name) then
  1513. script:Clone().Parent = game.ServerStorage
  1514. end
  1515. end
  1516.  
  1517. local AI = require(game.ServerStorage.ROBLOX_ZombieAI).new(zombie)
  1518. local DestroyService = require(game.ServerStorage.ROBLOX_DestroyService)
  1519.  
  1520.  
  1521. local function clearParts(parent)
  1522. for _, part in pairs(parent:GetChildren()) do
  1523. clearParts(part)
  1524. end
  1525. local delay
  1526. if parent:IsA("Part") then
  1527. delay = math.random(5,10)
  1528. else
  1529. delay = 11
  1530. end
  1531. DestroyService:AddItem(parent, delay)
  1532. end
  1533.  
  1534. zombie.Humanoid.Died:connect(function()
  1535. AI.Stop()
  1536. math.randomseed(tick())
  1537. clearParts(zombie)
  1538. script.Disabled = true
  1539. end)
  1540.  
  1541. local lastMoan = os.time()
  1542. math.randomseed(os.time())
  1543. while true do
  1544. local animationTrack = zombie.Humanoid:LoadAnimation(zombie.Animations.Arms)
  1545. animationTrack:Play()
  1546. -- local now = os.time()
  1547. -- if now - lastMoan > 5 then
  1548. -- if math.random() > .3 then
  1549. -- zombie.Moan:Play()
  1550. ---- print("playing moan")
  1551. -- lastMoan = now
  1552. -- end
  1553. -- end
  1554. wait(2)
  1555. end
  1556.  
  1557. end;}local ActualScripts = {}
  1558. function s(var)
  1559. local func = table.remove(Scripts,1)
  1560. setfenv(func,setmetatable({script=var,require=fake_require or require,global=genv},{
  1561. __index = getfenv(func),
  1562. }))
  1563. table.insert(ActualScripts,coroutine.wrap(func))
  1564. end
  1565.  
  1566. local Part_Classes = {"Part","WedgePart","CornerWedgePart"}
  1567. local Part_Shapes = {"Brick","Cylinder","Sphere","Torso","Wedge"}
  1568. function DecodeUnion(t)
  1569. local r = function()return table.remove(t,1) end
  1570. local split = function(str,sep)
  1571. local fields = {}
  1572. str:gsub(("([^%s]+)"):format(sep or ','),function(c)fields[#fields+1]=c end)
  1573. return fields
  1574. end
  1575. local m = Instance.new("Folder")
  1576. m.Name = "UnionCache ["..tostring(math.random(1,9999)).."]"
  1577. m.Archivable = false
  1578. m.Parent = game:GetService("ServerStorage")
  1579. local Union,Subtract = {},{}
  1580. repeat
  1581. local isNegate = false
  1582. local class = r()
  1583. if class=='-' then
  1584. isNegate = true
  1585. class = r()
  1586. end
  1587. if class=='n' then
  1588. local d = {}
  1589. local a = r()
  1590. repeat
  1591. table.insert(d,a)
  1592. a = r()
  1593. until a=='p'
  1594. local u = DecodeUnion(d)
  1595. if u then
  1596. table.insert(isNegate and Subtract or Union,u)
  1597. end
  1598. else
  1599. local size,pos,rot = Vector3.new(unpack(split(r()))),Vector3.new(unpack(split(r()))),Vector3.new(unpack(split(r())))
  1600. local part = Instance.new(Part_Classes[tonumber(class)])
  1601. part.Size = size
  1602. part.Position = pos
  1603. part.Orientation = rot
  1604. if r()=="+" then
  1605. local m,ms,of = r(),Vector3.new(unpack(split(r()))),Vector3.new(unpack(split(r())))
  1606. if tonumber(m)==6 then
  1607. part.Shape = Enum.PartType.Cylinder
  1608. elseif tonumber(m)==7 then
  1609. part.Shape = Enum.PartType.Ball
  1610. else
  1611. local mesh = Instance.new(tonumber(m)==8 and "CylinderMesh" or "SpecialMesh")
  1612. if tonumber(m)~=8 then
  1613. mesh.MeshType = Enum.MeshType[Part_Shapes[tonumber(m)]]
  1614. end
  1615. mesh.Scale = ms
  1616. mesh.Offset = of
  1617. mesh.Parent = part
  1618. end
  1619. end
  1620. table.insert(isNegate and Subtract or Union,part)
  1621. end
  1622. until #t<=0
  1623. local first = Union[1]
  1624. first.Parent = m
  1625. if #Union>1 then
  1626. first = first:UnionAsync(Union)
  1627. first.Parent = m
  1628. end
  1629. if #Subtract>0 then
  1630. first = first:SubtractAsync(Subtract)
  1631. first.Parent = m
  1632. end
  1633. first.Parent = nil
  1634. m:Destroy()
  1635. return first
  1636. end
  1637. Decode = function(str,t,props,classes,values,ICList,Model,CurPar,LastIns,split,RemoveAndSplit,InstanceList)
  1638. local tonum,table_remove,inst,parnt,comma,table_foreach = tonumber,table.remove,Instance.new,"Parent",",",
  1639. function(t,f)
  1640. for a,b in pairs(t) do
  1641. f(a,b)
  1642. end
  1643. end
  1644. local Types = {
  1645. Color3 = Color3.new,
  1646. Vector3 = Vector3.new,
  1647. Vector2 = Vector2.new,
  1648. UDim = UDim.new,
  1649. UDim2 = UDim2.new,
  1650. CFrame = CFrame.new,
  1651. Rect = Rect.new,
  1652. NumberRange = NumberRange.new,
  1653. BrickColor = BrickColor.new,
  1654. PhysicalProperties = PhysicalProperties.new,
  1655. NumberSequence = function(...)
  1656. local a = {...}
  1657. local t = {}
  1658. repeat
  1659. t[#t+1] = NumberSequenceKeypoint.new(table_remove(a,1),table_remove(a,1),table_remove(a,1))
  1660. until #a==0
  1661. return NumberSequence.new(t)
  1662. end,
  1663. ColorSequence = function(...)
  1664. local a = {...}
  1665. local t = {}
  1666. repeat
  1667. t[#t+1] = ColorSequenceKeypoint.new(table_remove(a,1),Color3.new(table_remove(a,1),table_remove(a,1),table_remove(a,1)))
  1668. until #a==0
  1669. return ColorSequence.new(t)
  1670. end,
  1671. number = tonumber,
  1672. boolean = function(a)
  1673. return a=="1"
  1674. end
  1675. }
  1676. split = function(str,sep)
  1677. if not str then return end
  1678. local fields = {}
  1679. local ConcatNext = false
  1680. str:gsub(("([^%s]+)"):format(sep),function(c)
  1681. if ConcatNext == true then
  1682. fields[#fields] = fields[#fields]..sep..c
  1683. ConcatNext = false
  1684. else
  1685. fields[#fields+1] = c
  1686. end
  1687. if c:sub(#c)=="\\" then
  1688. c = fields[#fields]
  1689. fields[#fields] = c:sub(1,#c-1)
  1690. ConcatNext = true
  1691. end
  1692. end)
  1693. return fields
  1694. end
  1695. RemoveAndSplit = function(t)
  1696. return split(table_remove(t,1),comma)
  1697. end
  1698. t = split(str,";")
  1699. props = RemoveAndSplit(t)
  1700. classes = RemoveAndSplit(t)
  1701. values = split(table_remove(t,1),'|')
  1702. ICList = RemoveAndSplit(t)
  1703. InstanceList = {}
  1704. Model = inst"Model"
  1705. CurPar = Model
  1706. table_foreach(t,function(ct,c)
  1707. if c=="n" or c=="p" then
  1708. CurPar = c=="n" and LastIns or CurPar[parnt]
  1709. else
  1710. ct = split(c,"|")
  1711. local class = classes[tonum(table_remove(ct,1))]
  1712. if class=="UnionOperation" then
  1713. LastIns = {UsePartColor="1"}
  1714. else
  1715. LastIns = inst(class)
  1716. if LastIns:IsA"Script" then
  1717. s(LastIns)
  1718. elseif LastIns:IsA("ModuleScript") then
  1719. ms(LastIns)
  1720. end
  1721. end
  1722.  
  1723. local function SetProperty(LastIns,p,str,s)
  1724. s = Types[typeof(LastIns[p])]
  1725. if p=="CustomPhysicalProperties" then
  1726. s = PhysicalProperties.new
  1727. end
  1728. if s then
  1729. LastIns[p] = s(unpack(split(str,comma)))
  1730. else
  1731. LastIns[p] = str
  1732. end
  1733. end
  1734.  
  1735. local UnionData
  1736. table_foreach(ct,function(s,p,a,str)
  1737. a = p:find":"
  1738. p,str = props[tonum(p:sub(1,a-1))],values[tonum(p:sub(a+1))]
  1739. if p=="UnionData" then
  1740. UnionData = split(str," ")
  1741. return
  1742. end
  1743. if class=="UnionOperation" then
  1744. LastIns[p] = str
  1745. return
  1746. end
  1747. SetProperty(LastIns,p,str)
  1748. end)
  1749.  
  1750. if UnionData then
  1751. local LI_Data = LastIns
  1752. LastIns = DecodeUnion(UnionData)
  1753. table_foreach(LI_Data,function(p,str)
  1754. SetProperty(LastIns,p,str)
  1755. end)
  1756. end
  1757. table.insert(InstanceList,LastIns)
  1758. LastIns[parnt] = CurPar
  1759. end
  1760. end)
  1761. table_remove(ICList,1)
  1762. table_foreach(ICList,function(a,b)
  1763. b = split(b,">")
  1764. InstanceList[tonum(b[1])][props[tonum(b[2])]] = InstanceList[tonum(b[3])]
  1765. end)
  1766.  
  1767. return Model:GetChildren()
  1768. end
  1769.  
  1770. local Objects = Decode('Name,Color,Material,Transparency,Position,Orientation,Size,BottomSurface,TopSurface,MaxVelocity,C0,C1,Part0,Part1,Force,CanCollide,UnionData,SecondaryColor,MeshType,Scale,WalkSpeed,AnimationId,Value,S'
  1771. ..'tudsOffset,BackgroundColor3,Visible,Font,Text,TextSize,MeshId,OverlayTextureId,BodyPart,PlaybackSpeed,SoundId,Volume,HeadColor3,LeftArmColor3,RightArmColor3,LeftLegColor3,RightLegColor3,TorsoColor3;Pa'
  1772. ..'rt,Model,Motor6D,BodyForce,MeshPart,UnionOperation,SpecialMesh,Fire,WedgePart,Script,Humanoid,StringValue,Animation,NumberValue,BillboardGui,TextLabel,Configuration,ModuleScript,IntValue,BoolValue,Cha'
  1773. ..'racterMesh,Sound,BodyColors;Part|Alien|HumanoidRootPart|0.1529,0.2745,0.1764|528|1|10.8326,3,-4.9814|0,-180,0|2,2,1|0|Root Hip|0.1|0,0,0,-1,0,0,0,0,1,0,1,-0|Torso|Left Hip|-1,-1,0,-0.0001,0,-1,0,0.999'
  1774. ..'9,0,1,0,-0.0001|-0.5,1,0,-0.0001,0,-1,0,0.9999,0,1,0,-0.0001|Right Hip|1,-1,0,-0.0001,0,1,-0,0.9999,0,-1,0,-0.0001|0.5,1,0,-0.0001,0,1,0,0.9999,0,-1,0,-0.0001|Left Shoulder|-1,0.5,0,-0.0001,0,-1,0,0.9'
  1775. ..'999,0,1,0,-0.0001|0.5,0.5,0,-0.0001,0,-1,0,0.9999,0,1,0,-0.0001|Right Shoulder|1,0.5,0,-0.0001,0,1,-0,0.9999,0,-1,0,-0.0001|-0.5,0.5,0,-0.0001,0,1,0,0.9999,0,-1,0,-0.0001|Neck|0,1,0,-1,0,0,0,0,1,0,1,-'
  1776. ..'0|0,-0.5,0,-1,0,0,0,0,1,0,1,-0|RepulsionForce|0,0,0|EnhancedCone|0.0666,0.0666,0.0666|8.5537,3.2582,0.1622|0.1099,102.1299,-115.7201|0.65,3.43,0.6899|0|6.9107,3.4991,0.7543|4.01,110.25,-115.4301|12.00'
  1777. ..'42,3.4991,-0.4154|4.01,97.25,-115.4301|11.741,4.2006,-7.0315|0,-180,179|1,8.3,1|13.7383,3.2583,-0.6227|0.1099,89.1299,-115.7201|12.8813,3.2653,-0.6246|1.85,92.7399,-115.6601|9.4665,4.2006,-7.0314|0,-1'
  1778. ..'80,-179|7.7182,3.2653,0.3532|1.85,105.7399,-115.6601|1 1.4,0.1,2.0999 11.5368,22.368,-7.0307 11,-180,20 = 1 1.4,0.1,2.0999 11.4939,21.9654,-6.9524 11,-180,20 = 1 1.4,0.1,2.0999 11.563,24.4479,-7.435 1'
  1779. ..'1,-180,20 = 1 1.4,0.1,2.0999 11.6059,24.8504,-7.5132 11,-180,20 = 1 1.3,0.1,2.0999 11.6183,23.5924,-7.2687 11,-180,20 = 1 1.3,0.1,2.0999 11.5755,23.1899,-7.1904 11,-180,20 = 1 1.3,0.1,2.0999 11.6359,2'
  1780. ..'5.362,-7.6127 11,-180,20 = 1 1.2,0.1,2.0999 11.6142,24.0117,-7.3502 11,-180,20 = 1 1.3,0.1,2.0999 11.5326,22.7873,-7.1122 11,-180,20 = 1 1.4,0.1,2.0999 9.6829,21.96,-6.942 -10,0,20 = - 1 3,4,1.8999 10'
  1781. ..'.6226,23.7248,-7.3232 -10,0,0 = 1 1.4,0.1,2.0999 9.6138,24.4504,-7.3811 -10,0,20 = 1 1.4,0.1,2.0999 9.571,24.8543,-7.4523 -10,0,20 = 1 1.4,0.1,2.0999 9.6401,22.3638,-7.0132 -10,0,20 = 1 1.3,0.1,2.0999'
  1782. ..' 9.5585,23.5922,-7.2298 -10,0,20 = 1 1.3,0.1,2.0999 9.6014,23.1884,-7.1586 -10,0,20 = 1 1.2,0.1,2.0999 9.5627,24.0129,-7.304 -10,0,20 = 1 1.3,0.1,2.0999 9.5409,25.3675,-7.5428 -10,0,20 = 1 1.3,0.1,2.0'
  1783. ..'999 9.6442,22.7845,-7.0874 -10,0,20 =|272|1 1.6799,1.7999,3.5 10.6226,28.6988,-7.274 -89,-179.9901,89.9899 + 3 1,1,1 0,0,0 - 1 2.2,0.7999,1.4999 11.6427,27.9628,-7.1194 7.0799,-13.79,-104.17 = - 1 2.2'
  1784. ..',0.7999,1.4999 9.6427,27.9127,-7.1194 -5.77,-172.34,-106.0801 =|12.5844,5.3627,1.2817|14.9899,91.08,-172.4701|1,2.9,0.7199|8.7141,7.3797,1.2228|6.7699,111.5299,138.9499|9.6026,11.9995,-7.0315|0,0,-1|1'
  1785. ..',8,1|13.2543,21.2706,-8.0611|-2.01,-0.02,5.9899|1,9,1|8.4037,5.2146,2.1408|7.0599,103.0199,-172.67|8.2175,7.4678,1.3948|14.9899,104.08,137.5299|8.9405,5.1787,1.8418|0.1099,102.1299,-172.7201|13.1335,7'
  1786. ..'.4679,0.5026|14.9899,91.08,137.5299|11.6049,11.9995,-7.0315|0,0,1|13.5903,12.5909,-4.1252|-40.75,-4.99,1.9099|1,12,1|13.4512,7.4043,0.4775|11.2799,94.5199,138.32|13.7374,5.1787,1.1008|0.1099,89.1299,-'
  1787. ..'172.7201|13.656,7.3797,0.4468|6.7699,98.5299,138.9499|10.6226,16.1002,-7.0315|2.6,1,0.9999|13.147,5.2147,1.2714|7.0599,90.0199,-172.67|7.7874,21.1478,-7.6363|-1.9701,22.3999,-6.02|10.6226,20.7467,-7.5'
  1788. ..'143|-5,0,0|1,9.9,1|7.9246,12.5911,-3.4176|-40.7001,27.3999,-13.95|0.9294,0.9176,0.9176|100|10.6226,23.3742,-6.7404|1,1,1|8.5214,7.4043,1.2989|11.2799,107.5199,138.32|7.8577,5.3627,2.2774|14.9899,104.0'
  1789. ..'8,-172.4701|10.6226,29.1661,-6.3885|1,-180,0|0.2,1,0.2999|Sphere|288|11.1726,29.2996,-6.7343|-84,-23,-90|0.4799,0.2999,0.2|3|10.0726,29.2996,-6.7342|-84,37,-90|10.6226,29.3818,-7.5542|-84,0,-90|2.1799'
  1790. ..',2,2.6|10.6226,23.0424,-8.2423|-79,-180,90|1.3799,2,6|9.9726,16.8002,-7.0315|0,-90,0|1,0.3999,1.2999|11.2726,16.7502,-7.0315|0,90,0|1,0.2999,1.2999|qPerfectionWeld|Left Leg|11.3327,1,-4.9814|1,2,1|Rig'
  1791. ..'ht Leg|10.3327,1,-4.9814|Left Arm|12.3326,3,-4.9814|Right Arm|9.3326,3,-4.9814|Head|0.2274,0.4901,0.0823|10.8326,4.5,-4.9814|2,1,1|1.25,1.25,1.25|21|Animate|climb|ClimbAnim|http://www.roblox.com/asset'
  1792. ..'/?id=125750800|fall|FallAnim|http://www.roblox.com/asset/?id=125750759|idle|Animation1|http://www.roblox.com/asset/?id=125750544|Weight|9|Animation2|http://www.roblox.com/asset/?id=125750618|jump|Jump'
  1793. ..'Anim|http://www.roblox.com/asset/?id=125750702|run|RunAnim|http://www.roblox.com/asset/?id=125749145|toolnone|ToolNoneAnim|http://www.roblox.com/asset/?id=125750867|walk|WalkAnim|0,100,0,30|0,5,0|1,0,'
  1794. ..'1,0|4|Idle|24|ModuleScripts|ROBLOX_AIUtilities|ROBLOX_DestroyService|ROBLOX_HumanoidList|ROBLOX_StateMachine|ROBLOX_ZombieAI|ROBLOX_PathfindingLibrary|Configurations|Damage|30|Debug|FieldOfView|180|Ag'
  1795. ..'groRange|200|Animations|Attack|http://www.roblox.com/asset/?id=180416148|Arms|http://www.roblox.com/asset/?id=183294396|Zombie Left Arm|37683097|37686282|2|Zombie Left Leg|37683150|37687646|Zombie Rig'
  1796. ..'ht Arm|37683174|Zombie Right Leg|37683227|5|Zombie torso|37683263|1|Moan|0.15|http://www.roblox.com/asset/?id=12222242|0.05;0,3>13>2,3>14>4,5>13>4,5>14>75,6>13>4,6>14>76,7>13>4,7>14>77,8>13>4,8>14>78,'
  1797. ..'9>13>4,9>14>79;2|1:2;n;1|1:3|2:4|3:5|4:6|5:7|6:8|7:9|8:10|9:10|2:4|2:4;n;3|1:11|10:12|11:13|12:13;p;1|1:14|2:4|3:5|4:6|5:7|6:8|7:9|8:10|9:10|2:4|2:4;n;3|1:15|10:12|11:16|12:17;3|1:18|10:12|11:19|12:20'
  1798. ..';3|1:21|10:12|11:22|12:23;3|1:24|10:12|11:25|12:26;3|1:27|10:12|11:28|12:29;4|1:30|15:31;2|1:2;n;5|1:32|2:33|5:34|6:35|7:36|16:37|2:33|2:33;5|1:32|2:33|5:38|6:39|7:36|16:37|2:33|2:33;5|1:32|2:33|5:40|'
  1799. ..'6:41|7:36|16:37|2:33|2:33;5|1:32|2:33|5:42|6:43|7:44|16:37|2:33|2:33;5|1:32|2:33|5:45|6:46|7:36|16:37|2:33|2:33;5|1:32|2:33|5:47|6:48|7:36|16:37|2:33|2:33;5|1:32|2:33|5:49|6:50|7:44|16:37|2:33|2:33;5|'
  1800. ..'1:32|2:33|5:51|6:52|7:36|16:37|2:33|2:33;6|2:33|16:37|2:33|2:33|17:53;6|2:33|3:54|16:37|2:33|2:33|17:55;1|2:33|5:56|6:57|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:59|6:60|7:58|16:37|8:10|9:10|2:33'
  1801. ..'|2:33;n;7;p;1|2:33|5:61|6:62|7:63|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:64|6:65|7:66|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:67|6:68|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:69|6:70|7:58|16:3'
  1802. ..'7|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:71|6:72|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:73|6:74|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:75|6:76|7:63|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:7'
  1803. ..'7|6:78|7:79|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:80|6:81|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:82|6:83|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:84|6:85|7:58|16:37|8:10|9:10|2:33|2:33;'
  1804. ..'n;7;p;1|2:33|5:86|7:87|16:37|8:10|9:10|2:33|2:33;1|2:33|5:88|6:89|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:90|6:91|7:66|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:33|5:92|6:93|7:94|16:37|8:10|9:10|2:33|'
  1805. ..'2:33;n;7;p;1|2:33|5:95|6:96|7:79|16:37|8:10|9:10|2:33|2:33;n;7;p;1|2:97|4:98|5:99|6:93|7:100|16:37|8:10|9:10|2:97|2:97;n;8|2:100|18:100|2:100|2:100;p;1|2:33|5:101|6:102|7:58|16:37|8:10|9:10|2:33|2:33;'
  1806. ..'n;7;p;1|2:33|5:103|6:104|7:58|16:37|8:10|9:10|2:33|2:33;n;7;p;9|2:33|3:54|5:105|6:106|7:107|16:37|2:33|2:33;1|1:108|2:97|3:109|5:110|6:111|7:112|16:37|8:10|9:10|2:97|2:97;n;7|19:113;p;1|1:108|2:97|3:1'
  1807. ..'09|5:114|6:115|7:112|16:37|8:10|9:10|2:97|2:97;n;7|19:113;p;1|1:108|2:33|3:54|5:116|6:117|7:118|16:37|8:10|9:10|2:33|2:33;n;7|19:113;p;1|1:108|2:33|3:54|5:119|6:120|7:121|16:37|8:10|9:10|2:33|2:33;n;7'
  1808. ..'|19:113;p;9|2:33|5:122|6:123|7:124|16:37|8:10|2:33|2:33;9|2:33|5:125|6:126|7:127|16:37|8:10|2:33|2:33;p;10|1:128;p;1|1:129|2:4|3:5|4:6|5:130|6:8|7:131|16:37|8:10|9:10|2:4|2:4;1|1:132|2:4|3:5|4:6|5:133'
  1809. ..'|6:8|7:131|16:37|8:10|9:10|2:4|2:4;1|1:134|2:4|3:5|4:6|5:135|6:8|7:131|16:37|8:10|9:10|2:4|2:4;1|1:136|2:4|3:5|4:6|5:137|6:8|7:131|16:37|8:10|9:10|2:4|2:4;1|1:138|2:139|3:5|4:6|5:140|6:8|7:141|8:10|9:'
  1810. ..'10|2:139|2:139;n;7|20:142;p;11|21:143;10|1:144;n;12|1:145;n;13|1:146|22:147;p;12|1:148;n;13|1:149|22:150;p;12|1:151;n;13|1:152|22:153;n;14|1:154|23:155;p;13|1:156|22:157;n;14|1:154|23:6;p;p;12|1:158;n'
  1811. ..';13|1:159|22:160;p;12|1:161;n;13|1:162|22:163;p;12|1:164;n;13|1:165|22:166;p;12|1:167;n;13|1:168|22:163;p;p;10;15|7:169|24:170;n;16|7:171|25:100|26:37|27:172|28:173|29:174;p;17|1:175;n;18|1:176;18|1:1'
  1812. ..'77;18|1:178;18|1:179;18|1:180;18|1:181;p;17|1:182;n;19|1:183|23:184;20|1:185;19|1:186|23:187;19|1:188|23:189;p;17|1:190;n;13|1:191|22:192;13|1:193|22:194;p;21|1:195|30:196|31:197|32:198;21|1:199|30:20'
  1813. ..'0|31:201|32:172;21|1:202|30:203|31:197|32:113;21|1:204|30:205|31:201|32:206;21|1:207|30:208|31:197|32:209;22|1:210|33:211|34:212|35:213;23|36:139|37:4|38:4|39:4|40:4|41:4;p;')
  1814. for _,Object in pairs(Objects) do
  1815. Object.Parent = script and script.Parent==workspace and script or workspace
  1816. end
  1817. for _,f in pairs(ActualScripts) do f() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement