Advertisement
bonniekawaiidesu

shrek

Mar 1st, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 58.68 KB | None | 0 0
  1. function sandbox(var,func)
  2.     local env = getfenv(func)
  3.     local newenv = setmetatable({},{
  4.         __index = function(self,k)
  5.             if k=="script" then
  6.                 return var
  7.             else
  8.                 return env[k]
  9.             end
  10.         end,
  11.     })
  12.     setfenv(func,newenv)
  13.     return func
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. Model0 = Instance.new("Model")
  18. Part1 = Instance.new("Part")
  19. SpecialMesh2 = Instance.new("SpecialMesh")
  20. Vector3Value3 = Instance.new("Vector3Value")
  21. Motor6D4 = Instance.new("Motor6D")
  22. Decal5 = Instance.new("Decal")
  23. Sound6 = Instance.new("Sound")
  24. Sound7 = Instance.new("Sound")
  25. Sound8 = Instance.new("Sound")
  26. Sound9 = Instance.new("Sound")
  27. Sound10 = Instance.new("Sound")
  28. Weld11 = Instance.new("Weld")
  29. Sound12 = Instance.new("Sound")
  30. Part13 = Instance.new("Part")
  31. Vector3Value14 = Instance.new("Vector3Value")
  32. Pants15 = Instance.new("Pants")
  33. MeshPart16 = Instance.new("MeshPart")
  34. Vector3Value17 = Instance.new("Vector3Value")
  35. Motor6D18 = Instance.new("Motor6D")
  36. Script19 = Instance.new("Script")
  37. Humanoid20 = Instance.new("Humanoid")
  38. Script21 = Instance.new("Script")
  39. StringValue22 = Instance.new("StringValue")
  40. StringValue23 = Instance.new("StringValue")
  41. Animation24 = Instance.new("Animation")
  42. StringValue25 = Instance.new("StringValue")
  43. Animation26 = Instance.new("Animation")
  44. StringValue27 = Instance.new("StringValue")
  45. Animation28 = Instance.new("Animation")
  46. NumberValue29 = Instance.new("NumberValue")
  47. Animation30 = Instance.new("Animation")
  48. NumberValue31 = Instance.new("NumberValue")
  49. StringValue32 = Instance.new("StringValue")
  50. Animation33 = Instance.new("Animation")
  51. StringValue34 = Instance.new("StringValue")
  52. Animation35 = Instance.new("Animation")
  53. StringValue36 = Instance.new("StringValue")
  54. Animation37 = Instance.new("Animation")
  55. StringValue38 = Instance.new("StringValue")
  56. Animation39 = Instance.new("Animation")
  57. StringValue40 = Instance.new("StringValue")
  58. Animation41 = Instance.new("Animation")
  59. StringValue42 = Instance.new("StringValue")
  60. Animation43 = Instance.new("Animation")
  61. MeshPart44 = Instance.new("MeshPart")
  62. Vector3Value45 = Instance.new("Vector3Value")
  63. Motor6D46 = Instance.new("Motor6D")
  64. MeshPart47 = Instance.new("MeshPart")
  65. Vector3Value48 = Instance.new("Vector3Value")
  66. Motor6D49 = Instance.new("Motor6D")
  67. MeshPart50 = Instance.new("MeshPart")
  68. Vector3Value51 = Instance.new("Vector3Value")
  69. Motor6D52 = Instance.new("Motor6D")
  70. MeshPart53 = Instance.new("MeshPart")
  71. Vector3Value54 = Instance.new("Vector3Value")
  72. Motor6D55 = Instance.new("Motor6D")
  73. MeshPart56 = Instance.new("MeshPart")
  74. Vector3Value57 = Instance.new("Vector3Value")
  75. Motor6D58 = Instance.new("Motor6D")
  76. MeshPart59 = Instance.new("MeshPart")
  77. Vector3Value60 = Instance.new("Vector3Value")
  78. Motor6D61 = Instance.new("Motor6D")
  79. MeshPart62 = Instance.new("MeshPart")
  80. Vector3Value63 = Instance.new("Vector3Value")
  81. Motor6D64 = Instance.new("Motor6D")
  82. MeshPart65 = Instance.new("MeshPart")
  83. Vector3Value66 = Instance.new("Vector3Value")
  84. Motor6D67 = Instance.new("Motor6D")
  85. Script68 = Instance.new("Script")
  86. MeshPart69 = Instance.new("MeshPart")
  87. Vector3Value70 = Instance.new("Vector3Value")
  88. Motor6D71 = Instance.new("Motor6D")
  89. MeshPart72 = Instance.new("MeshPart")
  90. Vector3Value73 = Instance.new("Vector3Value")
  91. Motor6D74 = Instance.new("Motor6D")
  92. MeshPart75 = Instance.new("MeshPart")
  93. Vector3Value76 = Instance.new("Vector3Value")
  94. Motor6D77 = Instance.new("Motor6D")
  95. MeshPart78 = Instance.new("MeshPart")
  96. Vector3Value79 = Instance.new("Vector3Value")
  97. Motor6D80 = Instance.new("Motor6D")
  98. MeshPart81 = Instance.new("MeshPart")
  99. Vector3Value82 = Instance.new("Vector3Value")
  100. Motor6D83 = Instance.new("Motor6D")
  101. Script84 = Instance.new("Script")
  102. Script85 = Instance.new("Script")
  103. BodyColors86 = Instance.new("BodyColors")
  104. Shirt87 = Instance.new("Shirt")
  105. Hat88 = Instance.new("Hat")
  106. Part89 = Instance.new("Part")
  107. SpecialMesh90 = Instance.new("SpecialMesh")
  108. Camera91 = Instance.new("Camera")
  109. Sound92 = Instance.new("Sound")
  110. Script93 = Instance.new("Script")
  111. Script94 = Instance.new("Script")
  112. Script95 = Instance.new("Script")
  113. Script96 = Instance.new("Script")
  114. Script97 = Instance.new("Script")
  115. LocalScript98 = Instance.new("LocalScript")
  116. Script99 = Instance.new("Script")
  117. Sound100 = Instance.new("Sound")
  118. Script101 = Instance.new("Script")
  119. Model0.Name = "Shrek is dreck"
  120. Model0.Parent = mas
  121. Part1.Name = "Head"
  122. Part1.Parent = Model0
  123. Part1.CFrame = CFrame.new(-14.3524885, 4.56509781, -21.9115772, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  124. Part1.Orientation = Vector3.new(0, 90.1399994, 0)
  125. Part1.Position = Vector3.new(-14.3524885, 4.56509781, -21.9115772)
  126. Part1.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  127. Part1.Color = Color3.new(0.643137, 0.741176, 0.278431)
  128. Part1.Size = Vector3.new(1, 1, 1)
  129. Part1.BottomSurface = Enum.SurfaceType.Smooth
  130. Part1.BrickColor = BrickColor.new("Br. yellowish green")
  131. Part1.TopSurface = Enum.SurfaceType.Smooth
  132. Part1.brickColor = BrickColor.new("Br. yellowish green")
  133. Part1.FormFactor = Enum.FormFactor.Custom
  134. Part1.formFactor = Enum.FormFactor.Custom
  135. SpecialMesh2.Parent = Part1
  136. SpecialMesh2.MeshId = "http://www.roblox.com/asset?id=419776358"
  137. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  138. Vector3Value3.Name = "OriginalSize"
  139. Vector3Value3.Parent = Part1
  140. Vector3Value3.Value = Vector3.new(1, 1, 1)
  141. Motor6D4.Name = "Neck"
  142. Motor6D4.Parent = Part1
  143. Motor6D4.C0 = CFrame.new(0.000338107347, 0.806032121, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  144. Motor6D4.C1 = CFrame.new(-2.72095203e-05, -0.565615535, 0.00386685133, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  145. Motor6D4.Part0 = MeshPart16
  146. Motor6D4.Part1 = Part1
  147. Motor6D4.part1 = Part1
  148. Decal5.Parent = Part1
  149. Decal5.Texture = "http://www.roblox.com/asset/?id=174393211"
  150. Sound6.Name = "Moan"
  151. Sound6.Parent = Part1
  152. Sound6.SoundId = "rbxassetid://131060249"
  153. Sound6.Volume = 1
  154. Sound7.Name = "Moan2"
  155. Sound7.Parent = Part1
  156. Sound7.SoundId = "rbxassetid://131060145"
  157. Sound7.Volume = 1
  158. Sound8.Name = "Moan3"
  159. Sound8.Parent = Part1
  160. Sound8.SoundId = "rbxassetid://131060210"
  161. Sound8.Volume = 1
  162. Sound9.Name = "Moan4"
  163. Sound9.Parent = Part1
  164. Sound9.SoundId = "rbxassetid://131138835"
  165. Sound9.Volume = 1
  166. Sound10.Name = "Death"
  167. Sound10.Parent = Part1
  168. Weld11.Name = "HeadWeld"
  169. Weld11.Parent = Part1
  170. Weld11.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  171. Weld11.C1 = CFrame.new(0, 0.300000012, 0.200000003, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  172. Weld11.Part0 = Part1
  173. Weld11.Part1 = Part89
  174. Weld11.part1 = Part89
  175. Sound12.Name = "Scream"
  176. Sound12.Parent = Part1
  177. Sound12.SoundId = "rbxassetid://449830565"
  178. Sound12.Volume = 1
  179. Part13.Name = "HumanoidRootPart"
  180. Part13.Parent = Model0
  181. Part13.CFrame = CFrame.new(-14.3486996, 2.32588005, -21.9115601, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  182. Part13.Orientation = Vector3.new(0, 90.1399994, 0)
  183. Part13.Position = Vector3.new(-14.3486996, 2.32588005, -21.9115601)
  184. Part13.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  185. Part13.Transparency = 1
  186. Part13.Size = Vector3.new(2, 2, 1)
  187. Part13.CanCollide = false
  188. Vector3Value14.Name = "OriginalSize"
  189. Vector3Value14.Parent = Part13
  190. Vector3Value14.Value = Vector3.new(2, 2, 1)
  191. Pants15.Parent = Model0
  192. Pants15.PantsTemplate = "rbxassetid://133078204"
  193. MeshPart16.Name = "UpperTorso"
  194. MeshPart16.Parent = Model0
  195. MeshPart16.CFrame = CFrame.new(-14.3331079, 3.1934495, -21.9112587, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  196. MeshPart16.Orientation = Vector3.new(0, 90.1399994, 0)
  197. MeshPart16.Position = Vector3.new(-14.3331079, 3.1934495, -21.9112587)
  198. MeshPart16.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  199. MeshPart16.Color = Color3.new(0.643137, 0.741176, 0.278431)
  200. MeshPart16.Size = Vector3.new(2.00029206, 1.60093355, 1.0005368)
  201. MeshPart16.BrickColor = BrickColor.new("Br. yellowish green")
  202. MeshPart16.brickColor = BrickColor.new("Br. yellowish green")
  203. Vector3Value17.Name = "OriginalSize"
  204. Vector3Value17.Parent = MeshPart16
  205. Vector3Value17.Value = Vector3.new(2.00029206, 1.60093355, 1.0005368)
  206. Motor6D18.Name = "Waist"
  207. Motor6D18.Parent = MeshPart16
  208. Motor6D18.C0 = CFrame.new(0.000280171633, 0.537143946, -0.0142721087, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  209. Motor6D18.C1 = CFrame.new(0.000338107347, -0.463463932, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  210. Motor6D18.Part0 = MeshPart65
  211. Motor6D18.Part1 = MeshPart16
  212. Motor6D18.part1 = MeshPart16
  213. Script19.Name = "Damage Script"
  214. Script19.Parent = MeshPart16
  215. table.insert(cors,sandbox(Script19,function()
  216. function onTouched(hit)
  217.         local human = hit.Parent:findFirstChild("Humanoid")
  218.         if (human ~= nil) then
  219.                 human.Health = human.Health - 5 -- Change the amount to change the damage.
  220.         end
  221. end
  222. script.Parent.Touched:connect(onTouched)
  223. end))
  224. Humanoid20.Name = "Zombie"
  225. Humanoid20.Parent = Model0
  226. Humanoid20.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Subject
  227. Humanoid20.Health = 125
  228. Humanoid20.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOn
  229. Humanoid20.HipHeight = 1.3500000238419
  230. Humanoid20.MaxHealth = 125
  231. Humanoid20.NameOcclusion = Enum.NameOcclusion.NoOcclusion
  232. Humanoid20.RigType = Enum.HumanoidRigType.R15
  233. Humanoid20.Torso = Part13
  234. Humanoid20.maxHealth = 125
  235. Script21.Name = "Animate"
  236. Script21.Parent = Model0
  237. table.insert(cors,sandbox(Script21,function()
  238. function   waitForChild(parent, childName)
  239.     local child = parent:findFirstChild(childName)
  240.     if child then return child end
  241.     while true do
  242.         child = parent.ChildAdded:wait()
  243.         if child.Name==childName then return child end
  244.     end
  245. end
  246.  
  247. local Figure = script.Parent
  248. local Humanoid = waitForChild(Figure, "Zombie")
  249. local pose = "Standing"
  250.  
  251. local currentAnim = ""
  252. local currentAnimInstance = nil
  253. local currentAnimTrack = nil
  254. local currentAnimKeyframeHandler = nil
  255. local currentAnimSpeed = 1.0
  256. local animTable = {}
  257. local animNames = {
  258.     idle =  {  
  259.                 { id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
  260.                 { id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
  261.                 { id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
  262.             },
  263.     walk =  {  
  264.                 { id = "http://www.roblox.com/asset/?id=507777826", weight = 10 }
  265.             },
  266.     run =   {
  267.                 { id = "http://www.roblox.com/asset/?id=507767714", weight = 10 }
  268.             },
  269.     swim =  {
  270.                 { id = "http://www.roblox.com/asset/?id=507784897", weight = 10 }
  271.             },
  272.     swimidle =  {
  273.                 { id = "http://www.roblox.com/asset/?id=507785072", weight = 10 }
  274.             },
  275.     jump =  {
  276.                 { id = "http://www.roblox.com/asset/?id=507765000", weight = 10 }
  277.             },
  278.     fall =  {
  279.                 { id = "http://www.roblox.com/asset/?id=507767968", weight = 10 }
  280.             },
  281.     climb = {
  282.                 { id = "http://www.roblox.com/asset/?id=507765644", weight = 10 }
  283.             },
  284.     sit =   {
  285.                 { id = "http://www.roblox.com/asset/?id=507768133", weight = 10 }
  286.             }, 
  287.     toolnone = {
  288.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  289.             },
  290.     toolslash = {
  291.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  292. --              { id = "slash.xml", weight = 10 }
  293.             },
  294.     toollunge = {
  295.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  296.             },
  297.     wave = {
  298.                 { id = "http://www.roblox.com/asset/?id=507770239", weight = 10 }
  299.             },
  300.     point = {
  301.                 { id = "http://www.roblox.com/asset/?id=507770453", weight = 10 }
  302.             },
  303.     dance = {
  304.                 { id = "http://www.roblox.com/asset/?id=507771019", weight = 10 },
  305.                 { id = "http://www.roblox.com/asset/?id=507771955", weight = 10 },
  306.                 { id = "http://www.roblox.com/asset/?id=507772104", weight = 10 }
  307.             },
  308.     dance2 = {
  309.                 { id = "http://www.roblox.com/asset/?id=507776043", weight = 10 },
  310.                 { id = "http://www.roblox.com/asset/?id=507776720", weight = 10 },
  311.                 { id = "http://www.roblox.com/asset/?id=507776879", weight = 10 }
  312.             },
  313.     dance3 = {
  314.                 { id = "http://www.roblox.com/asset/?id=507777268", weight = 10 },
  315.                 { id = "http://www.roblox.com/asset/?id=507777451", weight = 10 },
  316.                 { id = "http://www.roblox.com/asset/?id=507777623", weight = 10 }
  317.             },
  318.     laugh = {
  319.                 { id = "http://www.roblox.com/asset/?id=507770818", weight = 10 }
  320.             },
  321.     cheer = {
  322.                 { id = "http://www.roblox.com/asset/?id=507770677", weight = 10 }
  323.             },
  324. }
  325.  
  326. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  327. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  328.  
  329. math.randomseed(tick())
  330.  
  331. function configureAnimationSet(name, fileList)
  332.     if (animTable[name] ~= nil) then
  333.         for _, connection in pairs(animTable[name].connections) do
  334.             connection:disconnect()
  335.         end
  336.     end
  337.     animTable[name] = {}
  338.     animTable[name].count = 0
  339.     animTable[name].totalWeight = 0
  340.     animTable[name].connections = {}
  341.  
  342.     -- check for config values
  343.     local config = script:FindFirstChild(name)
  344.     if (config ~= nil) then
  345. --      print("Loading anims " .. name)
  346.         table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  347.         table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  348.         local idx = 1
  349.         for _, childPart in pairs(config:GetChildren()) do
  350.             if (childPart:IsA("Animation")) then
  351.                 table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  352.                 animTable[name][idx] = {}
  353.                 animTable[name][idx].anim = childPart
  354.                 local weightObject = childPart:FindFirstChild("Weight")
  355.                 if (weightObject == nil) then
  356.                     animTable[name][idx].weight = 1
  357.                 else
  358.                     animTable[name][idx].weight = weightObject.Value
  359.                 end
  360.                 animTable[name].count = animTable[name].count + 1
  361.                 animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  362. --              print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  363.                 idx = idx + 1
  364.             end
  365.         end
  366.     end
  367.  
  368.     -- fallback to defaults
  369.     if (animTable[name].count <= 0) then
  370.         for idx, anim in pairs(fileList) do
  371.             animTable[name][idx] = {}
  372.             animTable[name][idx].anim = Instance.new("Animation")
  373.             animTable[name][idx].anim.Name = name
  374.             animTable[name][idx].anim.AnimationId = anim.id
  375.             animTable[name][idx].weight = anim.weight
  376.             animTable[name].count = animTable[name].count + 1
  377.             animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  378. --          print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  379.         end
  380.     end
  381. end
  382.  
  383. -- Setup animation objects
  384. function scriptChildModified(child)
  385.     local fileList = animNames[child.Name]
  386.     if (fileList ~= nil) then
  387.         configureAnimationSet(child.Name, fileList)
  388.     end
  389. end
  390.  
  391. script.ChildAdded:connect(scriptChildModified)
  392. script.ChildRemoved:connect(scriptChildModified)
  393.  
  394.  
  395. for name, fileList in pairs(animNames) do
  396.     configureAnimationSet(name, fileList)
  397. end
  398.  
  399. -- ANIMATION
  400.  
  401. -- declarations
  402. local toolAnim = "None"
  403. local toolAnimTime = 0
  404.  
  405. local jumpAnimTime = 0
  406. local jumpAnimDuration = 0.31
  407.  
  408. local toolTransitionTime = 0.1
  409. local fallTransitionTime = 0.2
  410.  
  411. -- functions
  412.  
  413. function stopAllAnimations()
  414.     local oldAnim = currentAnim
  415.  
  416.     -- return to idle if finishing an emote
  417.     if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  418.         oldAnim = "idle"
  419.     end
  420.  
  421.     currentAnim = ""
  422.     currentAnimInstance = nil
  423.     if (currentAnimKeyframeHandler ~= nil) then
  424.         currentAnimKeyframeHandler:disconnect()
  425.     end
  426.  
  427.     if (currentAnimTrack ~= nil) then
  428.         currentAnimTrack:Stop()
  429.         currentAnimTrack:Destroy()
  430.         currentAnimTrack = nil
  431.     end
  432.     return oldAnim
  433. end
  434.  
  435. function setAnimationSpeed(speed)
  436.     if speed ~= currentAnimSpeed then
  437.         currentAnimSpeed = speed
  438.         currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  439.     end
  440. end
  441.  
  442. function keyFrameReachedFunc(frameName)
  443.     if (frameName == "End") then
  444. --      print("Keyframe : ".. frameName)
  445.  
  446.         local repeatAnim = currentAnim
  447.         -- return to idle if finishing an emote
  448.         if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  449.             repeatAnim = "idle"
  450.         end
  451.        
  452.         local animSpeed = currentAnimSpeed
  453.         playAnimation(repeatAnim, 0.15, Humanoid)
  454.         setAnimationSpeed(animSpeed)
  455.     end
  456. end
  457.  
  458. -- Preload animations
  459. function playAnimation(animName, transitionTime, humanoid)
  460.        
  461.     local roll = math.random(1, animTable[animName].totalWeight)
  462.     local origRoll = roll
  463.     local idx = 1
  464.     while (roll > animTable[animName][idx].weight) do
  465.         roll = roll - animTable[animName][idx].weight
  466.         idx = idx + 1
  467.     end
  468.    
  469. --  print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  470.    
  471.     local anim = animTable[animName][idx].anim
  472.  
  473.     -- switch animation    
  474.     if (anim ~= currentAnimInstance) then
  475.        
  476.         if (currentAnimTrack ~= nil) then
  477.             currentAnimTrack:Stop(transitionTime)
  478.             currentAnimTrack:Destroy()
  479.         end
  480.  
  481.         currentAnimSpeed = 1.0
  482.    
  483.         -- load it to the humanoid; get AnimationTrack
  484.         currentAnimTrack = humanoid:LoadAnimation(anim)
  485.          
  486.         -- play the animation
  487.         currentAnimTrack:Play(transitionTime)
  488.         currentAnim = animName
  489.         currentAnimInstance = anim
  490.  
  491.         -- set up keyframe name triggers
  492.         if (currentAnimKeyframeHandler ~= nil) then
  493.             currentAnimKeyframeHandler:disconnect()
  494.         end
  495.         currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  496.        
  497.     end
  498.  
  499. end
  500.  
  501. -------------------------------------------------------------------------------------------
  502. -------------------------------------------------------------------------------------------
  503.  
  504. local toolAnimName = ""
  505. local toolAnimTrack = nil
  506. local toolAnimInstance = nil
  507. local currentToolAnimKeyframeHandler = nil
  508.  
  509. function toolKeyFrameReachedFunc(frameName)
  510.     if (frameName == "End") then
  511. --      print("Keyframe : ".. frameName)   
  512.         playToolAnimation(toolAnimName, 0.0, Humanoid)
  513.     end
  514. end
  515.  
  516.  
  517. function playToolAnimation(animName, transitionTime, humanoid)   
  518.        
  519.         local roll = math.random(1, animTable[animName].totalWeight)
  520.         local origRoll = roll
  521.         local idx = 1
  522.         while (roll > animTable[animName][idx].weight) do
  523.             roll = roll - animTable[animName][idx].weight
  524.             idx = idx + 1
  525.         end
  526. --      print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  527.         local anim = animTable[animName][idx].anim
  528.  
  529.         if (toolAnimInstance ~= anim) then
  530.            
  531.             if (toolAnimTrack ~= nil) then
  532.                 toolAnimTrack:Stop()
  533.                 toolAnimTrack:Destroy()
  534.                 transitionTime = 0
  535.             end
  536.                    
  537.             -- load it to the humanoid; get AnimationTrack
  538.             toolAnimTrack = humanoid:LoadAnimation(anim)
  539.              
  540.             -- play the animation
  541.             toolAnimTrack:Play(transitionTime)
  542.             toolAnimName = animName
  543.             toolAnimInstance = anim
  544.  
  545.             currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  546.         end
  547. end
  548.  
  549. function stopToolAnimations()
  550.     local oldAnim = toolAnimName
  551.  
  552.     if (currentToolAnimKeyframeHandler ~= nil) then
  553.         currentToolAnimKeyframeHandler:disconnect()
  554.     end
  555.  
  556.     toolAnimName = ""
  557.     toolAnimInstance = nil
  558.     if (toolAnimTrack ~= nil) then
  559.         toolAnimTrack:Stop()
  560.         toolAnimTrack:Destroy()
  561.         toolAnimTrack = nil
  562.     end
  563.  
  564.  
  565.     return oldAnim
  566. end
  567.  
  568. -------------------------------------------------------------------------------------------
  569. -------------------------------------------------------------------------------------------
  570.  
  571.  
  572. function onRunning(speed)
  573.     if speed > 0.01 then
  574.         local scale = 15.0
  575.         playAnimation("walk", 0.1, Humanoid)
  576.         setAnimationSpeed(speed / scale)
  577.         pose = "Running"
  578.     else
  579.         playAnimation("idle", 0.1, Humanoid)
  580.         pose = "Standing"
  581.     end
  582. end
  583.  
  584. function onDied()
  585.     pose = "Dead"
  586. end
  587.  
  588. function onJumping()
  589.     playAnimation("jump", 0.1, Humanoid)
  590.     jumpAnimTime = jumpAnimDuration
  591.     pose = "Jumping"
  592. end
  593.  
  594. function onClimbing(speed)
  595.     local scale = 5.0
  596.     playAnimation("climb", 0.1, Humanoid)
  597.     setAnimationSpeed(speed / scale)
  598.     pose = "Climbing"
  599. end
  600.  
  601. function onGettingUp()
  602.     pose = "GettingUp"
  603. end
  604.  
  605. function onFreeFall()
  606.     if (jumpAnimTime <= 0) then
  607.         playAnimation("fall", fallTransitionTime, Humanoid)
  608.     end
  609.     pose = "FreeFall"
  610. end
  611.  
  612. function onFallingDown()
  613.     pose = "FallingDown"
  614. end
  615.  
  616. function onSeated()
  617.     pose = "Seated"
  618. end
  619.  
  620. function onPlatformStanding()
  621.     pose = "PlatformStanding"
  622. end
  623.  
  624. function onSwimming(speed)
  625.     if speed > 1.00 then
  626.         local scale = 10.0
  627.         playAnimation("swim", 0.4, Humanoid)
  628.         setAnimationSpeed(speed / scale)
  629.         pose = "Swimming"
  630.     else
  631.         playAnimation("swimidle", 0.4, Humanoid)
  632.         pose = "Standing"
  633.     end
  634. end
  635.  
  636. function getTool() 
  637.     for _, kid in ipairs(Figure:GetChildren()) do
  638.         if kid.className == "Tool" then return kid end
  639.     end
  640.     return nil
  641. end
  642.  
  643. function getToolAnim(tool)
  644.     for _, c in ipairs(tool:GetChildren()) do
  645.         if c.Name == "toolanim" and c.className == "StringValue" then
  646.             return c
  647.         end
  648.     end
  649.     return nil
  650. end
  651.  
  652. function animateTool()
  653.    
  654.     if (toolAnim == "None") then
  655.         playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  656.         return
  657.     end
  658.  
  659.     if (toolAnim == "Slash") then
  660.         playToolAnimation("toolslash", 0, Humanoid)
  661.         return
  662.     end
  663.  
  664.     if (toolAnim == "Lunge") then
  665.         playToolAnimation("toollunge", 0, Humanoid)
  666.         return
  667.     end
  668. end
  669.  
  670. function moveSit()
  671.     RightShoulder.MaxVelocity = 0.15
  672.     LeftShoulder.MaxVelocity = 0.15
  673.     RightShoulder:SetDesiredAngle(3.14 /2)
  674.     LeftShoulder:SetDesiredAngle(-3.14 /2)
  675.     RightHip:SetDesiredAngle(3.14 /2)
  676.     LeftHip:SetDesiredAngle(-3.14 /2)
  677. end
  678.  
  679. local lastTick = 0
  680.  
  681. function move(time)
  682.     local amplitude = 1
  683.     local frequency = 1
  684.     local deltaTime = time - lastTick
  685.     lastTick = time
  686.  
  687.     local climbFudge = 0
  688.     local setAngles = false
  689.  
  690.     if (jumpAnimTime > 0) then
  691.         jumpAnimTime = jumpAnimTime - deltaTime
  692.     end
  693.  
  694.     if (pose == "FreeFall" and jumpAnimTime <= 0) then
  695.         playAnimation("fall", fallTransitionTime, Humanoid)
  696.     elseif (pose == "Seated") then
  697.         playAnimation("sit", 0.5, Humanoid)
  698.         return
  699.     elseif (pose == "Running") then
  700.         playAnimation("walk", 0.1, Humanoid)
  701.     elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  702.         stopAllAnimations()
  703.         amplitude = 0.1
  704.         frequency = 1
  705.         setAngles = true
  706.     end
  707.  
  708.     -- Tool Animation handling
  709.     local tool = getTool()
  710.     if tool then
  711.    
  712.         animStringValueObject = getToolAnim(tool)
  713.  
  714.         if animStringValueObject then
  715.             toolAnim = animStringValueObject.Value
  716.             -- message recieved, delete StringValue
  717.             animStringValueObject.Parent = nil
  718.             toolAnimTime = time + .3
  719.         end
  720.  
  721.         if time > toolAnimTime then
  722.             toolAnimTime = 0
  723.             toolAnim = "None"
  724.         end
  725.  
  726.         animateTool()      
  727.     else
  728.         stopToolAnimations()
  729.         toolAnim = "None"
  730.         toolAnimInstance = nil
  731.         toolAnimTime = 0
  732.     end
  733. end
  734.  
  735. -- connect events
  736. Humanoid.Died:connect(onDied)
  737. Humanoid.Running:connect(onRunning)
  738. Humanoid.Jumping:connect(onJumping)
  739. Humanoid.Climbing:connect(onClimbing)
  740. Humanoid.GettingUp:connect(onGettingUp)
  741. Humanoid.FreeFalling:connect(onFreeFall)
  742. Humanoid.FallingDown:connect(onFallingDown)
  743. Humanoid.Seated:connect(onSeated)
  744. Humanoid.PlatformStanding:connect(onPlatformStanding)
  745. Humanoid.Swimming:connect(onSwimming)
  746.  
  747. -- setup emote chat hook
  748. script.msg.Changed:connect(function(msg)
  749.     script.msg.Value = ""
  750.     local emote = ""
  751.     if (string.sub(msg, 1, 3) == "/e ") then
  752.         emote = string.sub(msg, 4)
  753.     elseif (string.sub(msg, 1, 7) == "/emote ") then
  754.         emote = string.sub(msg, 8)
  755.     end
  756.    
  757.     if (pose == "Standing" and emoteNames[emote] ~= nil) then
  758.         playAnimation(emote, 0.1, Humanoid)
  759.     end
  760. --  print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
  761. end)
  762.  
  763.  
  764. -- main program
  765.  
  766. local runService = game:service("RunService");
  767.  
  768. -- print("bottom")
  769.  
  770. -- initialize to idle
  771. playAnimation("idle", 0.1, Humanoid)
  772. pose = "Standing"
  773.  
  774. while Figure.Parent~=nil do
  775.     local _, time = wait(0.1)
  776.     move(time)
  777. end
  778.  
  779.  
  780.  
  781. end))
  782. StringValue22.Name = "msg"
  783. StringValue22.Parent = Script21
  784. StringValue23.Name = "climb"
  785. StringValue23.Parent = Script21
  786. Animation24.Name = "ClimbAnim"
  787. Animation24.Parent = StringValue23
  788. Animation24.AnimationId = "http://www.roblox.com/asset/?id=616156119"
  789. StringValue25.Name = "fall"
  790. StringValue25.Parent = Script21
  791. Animation26.Name = "FallAnim"
  792. Animation26.Parent = StringValue25
  793. Animation26.AnimationId = "http://www.roblox.com/asset/?id=616157476"
  794. StringValue27.Name = "idle"
  795. StringValue27.Parent = Script21
  796. Animation28.Name = "Animation1"
  797. Animation28.Parent = StringValue27
  798. Animation28.AnimationId = "http://www.roblox.com/asset/?id=616158929"
  799. NumberValue29.Name = "Weight"
  800. NumberValue29.Parent = Animation28
  801. NumberValue29.Value = 9
  802. Animation30.Name = "Animation2"
  803. Animation30.Parent = StringValue27
  804. Animation30.AnimationId = "http://www.roblox.com/asset/?id=616160636"
  805. NumberValue31.Name = "Weight"
  806. NumberValue31.Parent = Animation30
  807. NumberValue31.Value = 1
  808. StringValue32.Name = "jump"
  809. StringValue32.Parent = Script21
  810. Animation33.Name = "JumpAnim"
  811. Animation33.Parent = StringValue32
  812. Animation33.AnimationId = "http://www.roblox.com/asset/?id=616161997"
  813. StringValue34.Name = "sit"
  814. StringValue34.Parent = Script21
  815. Animation35.Name = "SitAnim"
  816. Animation35.Parent = StringValue34
  817. Animation35.AnimationId = "http://www.roblox.com/asset/?id=507768133"
  818. StringValue36.Name = "swim"
  819. StringValue36.Parent = Script21
  820. Animation37.Name = "Swim"
  821. Animation37.Parent = StringValue36
  822. Animation37.AnimationId = "http://www.roblox.com/asset/?id=616165109"
  823. StringValue38.Name = "swimidle"
  824. StringValue38.Parent = Script21
  825. Animation39.Name = "SwimIdle"
  826. Animation39.Parent = StringValue38
  827. Animation39.AnimationId = "http://www.roblox.com/asset/?id=616166655"
  828. StringValue40.Name = "toolnone"
  829. StringValue40.Parent = Script21
  830. Animation41.Name = "ToolNoneAnim"
  831. Animation41.Parent = StringValue40
  832. Animation41.AnimationId = "http://www.roblox.com/asset/?id=507768375"
  833. StringValue42.Name = "walk"
  834. StringValue42.Parent = Script21
  835. Animation43.Name = "RunAnim"
  836. Animation43.Parent = StringValue42
  837. Animation43.AnimationId = "http://www.roblox.com/asset/?id=616168032"
  838. MeshPart44.Name = "RightUpperLeg"
  839. MeshPart44.Parent = Model0
  840. MeshPart44.CFrame = CFrame.new(-14.3351259, 1.46466565, -22.4125671, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  841. MeshPart44.Orientation = Vector3.new(0, 90.1399994, 0)
  842. MeshPart44.Position = Vector3.new(-14.3351259, 1.46466565, -22.4125671)
  843. MeshPart44.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  844. MeshPart44.Color = Color3.new(0.643137, 0.741176, 0.278431)
  845. MeshPart44.Size = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  846. MeshPart44.BrickColor = BrickColor.new("Br. yellowish green")
  847. MeshPart44.CanCollide = false
  848. MeshPart44.brickColor = BrickColor.new("Br. yellowish green")
  849. Vector3Value45.Name = "OriginalSize"
  850. Vector3Value45.Parent = MeshPart44
  851. Vector3Value45.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  852. Motor6D46.Name = "RightHip"
  853. Motor6D46.Parent = MeshPart44
  854. Motor6D46.C0 = CFrame.new(0.505080223, -0.243262246, 0.00102789141, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  855. Motor6D46.C1 = CFrame.new(0.00382620096, 0.484913796, 0.000486815348, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  856. Motor6D46.Part0 = MeshPart65
  857. Motor6D46.Part1 = MeshPart44
  858. Motor6D46.part1 = MeshPart44
  859. MeshPart47.Name = "RightUpperArm"
  860. MeshPart47.Parent = Model0
  861. MeshPart47.CFrame = CFrame.new(-14.3428421, 3.29312539, -23.4094353, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  862. MeshPart47.Orientation = Vector3.new(0, 90.1399994, 0)
  863. MeshPart47.Position = Vector3.new(-14.3428421, 3.29312539, -23.4094353)
  864. MeshPart47.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  865. MeshPart47.Color = Color3.new(0.643137, 0.741176, 0.278431)
  866. MeshPart47.Size = Vector3.new(1.00027633, 1.39554, 1.00025082)
  867. MeshPart47.BrickColor = BrickColor.new("Br. yellowish green")
  868. MeshPart47.CanCollide = false
  869. MeshPart47.brickColor = BrickColor.new("Br. yellowish green")
  870. Vector3Value48.Name = "OriginalSize"
  871. Vector3Value48.Parent = MeshPart47
  872. Vector3Value48.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
  873. Motor6D49.Name = "RightShoulder"
  874. Motor6D49.Parent = MeshPart47
  875. Motor6D49.C0 = CFrame.new(1.25031853, 0.5565539, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  876. Motor6D49.C1 = CFrame.new(-0.24787569, 0.456878304, -0.00944012403, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  877. Motor6D49.Part0 = MeshPart16
  878. Motor6D49.Part1 = MeshPart47
  879. Motor6D49.part1 = MeshPart47
  880. MeshPart50.Name = "RightLowerLeg"
  881. MeshPart50.Parent = Model0
  882. MeshPart50.CFrame = CFrame.new(-14.3348646, 0.910310864, -22.4125671, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  883. MeshPart50.Orientation = Vector3.new(0, 90.1399994, 0)
  884. MeshPart50.Position = Vector3.new(-14.3348646, 0.910310864, -22.4125671)
  885. MeshPart50.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  886. MeshPart50.Color = Color3.new(0.643137, 0.741176, 0.278431)
  887. MeshPart50.Size = Vector3.new(1.00027585, 1.48964536, 1.00032854)
  888. MeshPart50.BrickColor = BrickColor.new("Br. yellowish green")
  889. MeshPart50.CanCollide = false
  890. MeshPart50.brickColor = BrickColor.new("Br. yellowish green")
  891. Vector3Value51.Name = "OriginalSize"
  892. Vector3Value51.Parent = MeshPart50
  893. Vector3Value51.Value = Vector3.new(1.00027585, 1.48964536, 1.00032854)
  894. Motor6D52.Name = "RightKnee"
  895. Motor6D52.Parent = MeshPart50
  896. Motor6D52.C0 = CFrame.new(0.00382620096, -0.265086174, 0.000426991843, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  897. Motor6D52.C1 = CFrame.new(0.00382620096, 0.289268613, 0.000145851634, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  898. Motor6D52.Part0 = MeshPart44
  899. Motor6D52.Part1 = MeshPart50
  900. Motor6D52.part1 = MeshPart50
  901. MeshPart53.Name = "RightLowerArm"
  902. MeshPart53.Parent = Model0
  903. MeshPart53.CFrame = CFrame.new(-14.3423996, 2.90703535, -23.4094353, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  904. MeshPart53.Orientation = Vector3.new(0, 90.1399994, 0)
  905. MeshPart53.Position = Vector3.new(-14.3423996, 2.90703535, -23.4094353)
  906. MeshPart53.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  907. MeshPart53.Color = Color3.new(0.643137, 0.741176, 0.278431)
  908. MeshPart53.Size = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  909. MeshPart53.BrickColor = BrickColor.new("Br. yellowish green")
  910. MeshPart53.CanCollide = false
  911. MeshPart53.brickColor = BrickColor.new("Br. yellowish green")
  912. Vector3Value54.Name = "OriginalSize"
  913. Vector3Value54.Parent = MeshPart53
  914. Vector3Value54.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  915. Motor6D55.Name = "RightElbow"
  916. Motor6D55.Parent = MeshPart53
  917. Motor6D55.C0 = CFrame.new(0.00214397907, -0.263139546, -0.00944012403, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  918. Motor6D55.C1 = CFrame.new(0.00214457512, 0.122950554, -0.00989595056, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  919. Motor6D55.Part0 = MeshPart47
  920. Motor6D55.Part1 = MeshPart53
  921. Motor6D55.part1 = MeshPart53
  922. MeshPart56.Name = "RightHand"
  923. MeshPart56.Parent = Model0
  924. MeshPart56.CFrame = CFrame.new(-14.3368855, 2.1668787, -23.4107285, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  925. MeshPart56.Orientation = Vector3.new(0, 90.1399994, 0)
  926. MeshPart56.Position = Vector3.new(-14.3368855, 2.1668787, -23.4107285)
  927. MeshPart56.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  928. MeshPart56.Color = Color3.new(0.643137, 0.741176, 0.278431)
  929. MeshPart56.Size = Vector3.new(0.999299049, 0.335255772, 1.00029743)
  930. MeshPart56.BrickColor = BrickColor.new("Br. yellowish green")
  931. MeshPart56.CanCollide = false
  932. MeshPart56.brickColor = BrickColor.new("Br. yellowish green")
  933. Vector3Value57.Name = "OriginalSize"
  934. Vector3Value57.Parent = MeshPart56
  935. Vector3Value57.Value = Vector3.new(0.999299049, 0.335255772, 1.00029743)
  936. Motor6D58.Name = "RightWrist"
  937. Motor6D58.Parent = MeshPart56
  938. Motor6D58.C0 = CFrame.new(0.00214457512, -0.682049513, -0.00989595056, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  939. Motor6D58.C1 = CFrame.new(0.000865101814, 0.058106944, -0.0154390335, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  940. Motor6D58.Part0 = MeshPart53
  941. Motor6D58.Part1 = MeshPart56
  942. Motor6D58.part1 = MeshPart56
  943. MeshPart59.Name = "RightFoot"
  944. MeshPart59.Parent = Model0
  945. MeshPart59.CFrame = CFrame.new(-14.3347502, 0.167736173, -22.4073772, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  946. MeshPart59.Orientation = Vector3.new(0, 90.1399994, 0)
  947. MeshPart59.Position = Vector3.new(-14.3347502, 0.167736173, -22.4073772)
  948. MeshPart59.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  949. MeshPart59.Color = Color3.new(0.643137, 0.741176, 0.278431)
  950. MeshPart59.Size = Vector3.new(1.00063133, 0.335407376, 1.00020337)
  951. MeshPart59.BrickColor = BrickColor.new("Br. yellowish green")
  952. MeshPart59.CanCollide = false
  953. MeshPart59.brickColor = BrickColor.new("Br. yellowish green")
  954. Vector3Value60.Name = "OriginalSize"
  955. Vector3Value60.Parent = MeshPart59
  956. Vector3Value60.Value = Vector3.new(1.00063133, 0.335407376, 1.00020337)
  957. Motor6D61.Name = "RightAnkle"
  958. Motor6D61.Parent = MeshPart59
  959. Motor6D61.C0 = CFrame.new(0.00382620096, -0.710731506, 0.000283418223, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  960. Motor6D61.C1 = CFrame.new(0.00901681185, 0.0318431854, 0.000155551359, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  961. Motor6D61.Part0 = MeshPart50
  962. Motor6D61.Part1 = MeshPart59
  963. Motor6D61.part1 = MeshPart59
  964. MeshPart62.Name = "LeftFoot"
  965. MeshPart62.Parent = Model0
  966. MeshPart62.CFrame = CFrame.new(-14.3323555, 0.167736173, -21.4158134, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  967. MeshPart62.Orientation = Vector3.new(0, 90.1399994, 0)
  968. MeshPart62.Position = Vector3.new(-14.3323555, 0.167736173, -21.4158134)
  969. MeshPart62.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  970. MeshPart62.Color = Color3.new(0.643137, 0.741176, 0.278431)
  971. MeshPart62.Size = Vector3.new(1.00063133, 0.335407257, 1.00020337)
  972. MeshPart62.BrickColor = BrickColor.new("Br. yellowish green")
  973. MeshPart62.CanCollide = false
  974. MeshPart62.brickColor = BrickColor.new("Br. yellowish green")
  975. Vector3Value63.Name = "OriginalSize"
  976. Vector3Value63.Parent = MeshPart62
  977. Vector3Value63.Value = Vector3.new(1.00063133, 0.335407257, 1.00020337)
  978. Motor6D64.Name = "LeftAnkle"
  979. Motor6D64.Parent = MeshPart62
  980. Motor6D64.C0 = CFrame.new(-0.00382620096, -0.710131407, 0.00030554086, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  981. Motor6D64.C1 = CFrame.new(-0.00901681185, 0.032443285, 0.000177569687, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  982. Motor6D64.Part0 = MeshPart75
  983. Motor6D64.Part1 = MeshPart62
  984. Motor6D64.part1 = MeshPart62
  985. MeshPart65.Name = "LowerTorso"
  986. MeshPart65.Parent = Model0
  987. MeshPart65.CFrame = CFrame.new(-14.3344316, 2.19284177, -21.911314, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  988. MeshPart65.Orientation = Vector3.new(0, 90.1399994, 0)
  989. MeshPart65.Position = Vector3.new(-14.3344316, 2.19284177, -21.911314)
  990. MeshPart65.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  991. MeshPart65.Color = Color3.new(0.643137, 0.741176, 0.278431)
  992. MeshPart65.Size = Vector3.new(2.00017595, 0.400037616, 1.00021255)
  993. MeshPart65.BrickColor = BrickColor.new("Br. yellowish green")
  994. MeshPart65.brickColor = BrickColor.new("Br. yellowish green")
  995. Vector3Value66.Name = "OriginalSize"
  996. Vector3Value66.Parent = MeshPart65
  997. Vector3Value66.Value = Vector3.new(2.00017595, 0.400037616, 1.00021255)
  998. Motor6D67.Name = "Root"
  999. Motor6D67.Parent = MeshPart65
  1000. Motor6D67.C1 = CFrame.new(0.000280171633, 0.133037761, -0.0142721087, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1001. Motor6D67.Part0 = Part13
  1002. Motor6D67.Part1 = MeshPart65
  1003. Motor6D67.part1 = MeshPart65
  1004. Script68.Name = "Damage Script"
  1005. Script68.Parent = MeshPart65
  1006. table.insert(cors,sandbox(Script68,function()
  1007. function onTouched(hit)
  1008.         local human = hit.Parent:findFirstChild("Humanoid")
  1009.         if (human ~= nil) then
  1010.                 human.Health = human.Health - 5 -- Change the amount to change the damage.
  1011.         end
  1012. end
  1013. script.Parent.Touched:connect(onTouched)
  1014. end))
  1015. MeshPart69.Name = "LeftUpperLeg"
  1016. MeshPart69.Parent = Model0
  1017. MeshPart69.CFrame = CFrame.new(-14.3327074, 1.46466565, -21.4106236, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  1018. MeshPart69.Orientation = Vector3.new(0, 90.1399994, 0)
  1019. MeshPart69.Position = Vector3.new(-14.3327074, 1.46466565, -21.4106236)
  1020. MeshPart69.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  1021. MeshPart69.Color = Color3.new(0.643137, 0.741176, 0.278431)
  1022. MeshPart69.Size = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  1023. MeshPart69.BrickColor = BrickColor.new("Br. yellowish green")
  1024. MeshPart69.CanCollide = false
  1025. MeshPart69.brickColor = BrickColor.new("Br. yellowish green")
  1026. Vector3Value70.Name = "OriginalSize"
  1027. Vector3Value70.Parent = MeshPart69
  1028. Vector3Value70.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  1029. Motor6D71.Name = "LeftHip"
  1030. Motor6D71.Parent = MeshPart69
  1031. Motor6D71.C0 = CFrame.new(-0.50451982, -0.243062243, 0.00122789107, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1032. Motor6D71.C1 = CFrame.new(-0.00382620096, 0.4851138, 0.000686740503, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1033. Motor6D71.Part0 = MeshPart65
  1034. Motor6D71.Part1 = MeshPart69
  1035. Motor6D71.part1 = MeshPart69
  1036. MeshPart72.Name = "LeftUpperArm"
  1037. MeshPart72.Parent = Model0
  1038. MeshPart72.CFrame = CFrame.new(-14.3356104, 3.29312539, -20.4137287, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  1039. MeshPart72.Orientation = Vector3.new(0, 90.1399994, 0)
  1040. MeshPart72.Position = Vector3.new(-14.3356104, 3.29312539, -20.4137287)
  1041. MeshPart72.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  1042. MeshPart72.Color = Color3.new(0.643137, 0.741176, 0.278431)
  1043. MeshPart72.Size = Vector3.new(1.00027633, 1.39554, 1.00025082)
  1044. MeshPart72.BrickColor = BrickColor.new("Br. yellowish green")
  1045. MeshPart72.CanCollide = false
  1046. MeshPart72.brickColor = BrickColor.new("Br. yellowish green")
  1047. Vector3Value73.Name = "OriginalSize"
  1048. Vector3Value73.Parent = MeshPart72
  1049. Vector3Value73.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
  1050. Motor6D74.Name = "LeftShoulder"
  1051. Motor6D74.Parent = MeshPart72
  1052. Motor6D74.C0 = CFrame.new(-1.24955308, 0.556408584, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1053. Motor6D74.C1 = CFrame.new(0.247964978, 0.456732988, -0.00943991542, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1054. Motor6D74.Part0 = MeshPart16
  1055. Motor6D74.Part1 = MeshPart72
  1056. Motor6D74.part1 = MeshPart72
  1057. MeshPart75.Name = "LeftLowerLeg"
  1058. MeshPart75.Parent = Model0
  1059. MeshPart75.CFrame = CFrame.new(-14.3324451, 0.910310864, -21.4106236, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  1060. MeshPart75.Orientation = Vector3.new(0, 90.1399994, 0)
  1061. MeshPart75.Position = Vector3.new(-14.3324451, 0.910310864, -21.4106236)
  1062. MeshPart75.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  1063. MeshPart75.Color = Color3.new(0.643137, 0.741176, 0.278431)
  1064. MeshPart75.Size = Vector3.new(1.00027585, 1.48964536, 1.00032866)
  1065. MeshPart75.BrickColor = BrickColor.new("Br. yellowish green")
  1066. MeshPart75.CanCollide = false
  1067. MeshPart75.brickColor = BrickColor.new("Br. yellowish green")
  1068. Vector3Value76.Name = "OriginalSize"
  1069. Vector3Value76.Parent = MeshPart75
  1070. Vector3Value76.Value = Vector3.new(1.00027585, 1.48964536, 1.00032866)
  1071. Motor6D77.Name = "LeftKnee"
  1072. Motor6D77.Parent = MeshPart75
  1073. Motor6D77.C0 = CFrame.new(-0.00382620096, -0.264486194, 0.000586740673, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1074. Motor6D77.C1 = CFrame.new(-0.00382620096, 0.289868593, 0.00030554086, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1075. Motor6D77.Part0 = MeshPart69
  1076. Motor6D77.Part1 = MeshPart75
  1077. Motor6D77.part1 = MeshPart75
  1078. MeshPart78.Name = "LeftLowerArm"
  1079. MeshPart78.Parent = Model0
  1080. MeshPart78.CFrame = CFrame.new(-14.3351679, 2.90703535, -20.4137306, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  1081. MeshPart78.Orientation = Vector3.new(0, 90.1399994, 0)
  1082. MeshPart78.Position = Vector3.new(-14.3351679, 2.90703535, -20.4137306)
  1083. MeshPart78.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  1084. MeshPart78.Color = Color3.new(0.643137, 0.741176, 0.278431)
  1085. MeshPart78.Size = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  1086. MeshPart78.BrickColor = BrickColor.new("Br. yellowish green")
  1087. MeshPart78.CanCollide = false
  1088. MeshPart78.brickColor = BrickColor.new("Br. yellowish green")
  1089. Vector3Value79.Name = "OriginalSize"
  1090. Vector3Value79.Parent = MeshPart78
  1091. Vector3Value79.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  1092. Motor6D80.Name = "LeftElbow"
  1093. Motor6D80.Parent = MeshPart78
  1094. Motor6D80.C0 = CFrame.new(-0.00166511536, -0.263139546, -0.00943991542, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1095. Motor6D80.C1 = CFrame.new(-0.0016657114, 0.122950554, -0.00989592075, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1096. Motor6D80.Part0 = MeshPart72
  1097. Motor6D80.Part1 = MeshPart78
  1098. Motor6D80.part1 = MeshPart78
  1099. MeshPart81.Name = "LeftHand"
  1100. MeshPart81.Parent = Model0
  1101. MeshPart81.CFrame = CFrame.new(-14.329648, 2.1668787, -20.4124641, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  1102. MeshPart81.Orientation = Vector3.new(0, 90.1399994, 0)
  1103. MeshPart81.Position = Vector3.new(-14.329648, 2.1668787, -20.4124641)
  1104. MeshPart81.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  1105. MeshPart81.Color = Color3.new(0.643137, 0.741176, 0.278431)
  1106. MeshPart81.Size = Vector3.new(0.999299049, 0.335255831, 1.00029743)
  1107. MeshPart81.BrickColor = BrickColor.new("Br. yellowish green")
  1108. MeshPart81.CanCollide = false
  1109. MeshPart81.brickColor = BrickColor.new("Br. yellowish green")
  1110. Vector3Value82.Name = "OriginalSize"
  1111. Vector3Value82.Parent = MeshPart81
  1112. Vector3Value82.Value = Vector3.new(0.999299049, 0.335255831, 1.00029743)
  1113. Motor6D83.Name = "LeftWrist"
  1114. Motor6D83.Parent = MeshPart81
  1115. Motor6D83.C0 = CFrame.new(-0.0016657114, -0.682255626, -0.00989592075, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1116. Motor6D83.C1 = CFrame.new(-0.000386238098, 0.0579008311, -0.0154390335, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1117. Motor6D83.Part0 = MeshPart78
  1118. Motor6D83.Part1 = MeshPart81
  1119. Motor6D83.part1 = MeshPart81
  1120. Script84.Name = "SoundScript"
  1121. Script84.Parent = Model0
  1122. table.insert(cors,sandbox(Script84,function()
  1123. local moan = script.Parent.Head.Scream
  1124. local moan2 = script.parent.Head.Scream
  1125. local moan3 = script.parent.Head.Scream
  1126. local moan4 = script.Parent.Head.Scream
  1127.  
  1128. while true do
  1129.     Scream:Play()
  1130.     wait(8)
  1131.    
  1132.     Scream:Play()
  1133.     wait(5)
  1134.    
  1135.     Scream:Play()
  1136.     wait(7)
  1137.    
  1138.     Scream:Play()
  1139.     wait(6)
  1140. end
  1141.  
  1142.  
  1143. local death = script.Parent.Head.Death
  1144.  
  1145.  
  1146. end))
  1147. Script85.Name = "Health"
  1148. Script85.Parent = Model0
  1149. table.insert(cors,sandbox(Script85,function()
  1150. --Responsible for regening a player's humanoid's health
  1151.  
  1152. -- declarations
  1153. local Figure = script.Parent
  1154. local Head = Figure:WaitForChild("Head")
  1155. local Humanoid = Figure:WaitForChild("Humanoid")
  1156. local regening = false
  1157.  
  1158. -- regeneration
  1159. function regenHealth()
  1160.     if regening then return end
  1161.     regening = true
  1162.    
  1163.     while Humanoid.Health < Humanoid.MaxHealth do
  1164.         local s = wait(1)
  1165.         local health = Humanoid.Health
  1166.         if health > 0 and health < Humanoid.MaxHealth then
  1167.             local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
  1168.             health = health + newHealthDelta
  1169.             Humanoid.Health = math.min(health,Humanoid.MaxHealth)
  1170.         end
  1171.     end
  1172.    
  1173.     if Humanoid.Health > Humanoid.MaxHealth then
  1174.         Humanoid.Health = Humanoid.MaxHealth
  1175.     end
  1176.    
  1177.     regening = false
  1178. end
  1179.  
  1180. Humanoid.HealthChanged:connect(regenHealth)
  1181.  
  1182. end))
  1183. BodyColors86.Parent = Model0
  1184. BodyColors86.HeadColor = BrickColor.new("Br. yellowish green")
  1185. BodyColors86.HeadColor3 = Color3.new(0.643137, 0.741176, 0.278431)
  1186. BodyColors86.LeftArmColor = BrickColor.new("Br. yellowish green")
  1187. BodyColors86.LeftArmColor3 = Color3.new(0.643137, 0.741176, 0.278431)
  1188. BodyColors86.LeftLegColor = BrickColor.new("Br. yellowish green")
  1189. BodyColors86.LeftLegColor3 = Color3.new(0.643137, 0.741176, 0.278431)
  1190. BodyColors86.RightArmColor = BrickColor.new("Br. yellowish green")
  1191. BodyColors86.RightArmColor3 = Color3.new(0.643137, 0.741176, 0.278431)
  1192. BodyColors86.RightLegColor = BrickColor.new("Br. yellowish green")
  1193. BodyColors86.RightLegColor3 = Color3.new(0.643137, 0.741176, 0.278431)
  1194. BodyColors86.TorsoColor = BrickColor.new("Br. yellowish green")
  1195. BodyColors86.TorsoColor3 = Color3.new(0.643137, 0.741176, 0.278431)
  1196. Shirt87.Parent = Model0
  1197. Shirt87.ShirtTemplate = "rbxassetid://133078194"
  1198. Hat88.Name = "ShrekHead"
  1199. Hat88.Parent = Model0
  1200. Hat88.AttachmentPoint = CFrame.new(0, 0.300000012, 0.200000003, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1201. Hat88.AttachmentPos = Vector3.new(0, 0.300000012, 0.200000003)
  1202. Part89.Name = "Handle"
  1203. Part89.Parent = Hat88
  1204. Part89.CFrame = CFrame.new(-14.5524807, 4.76510477, -21.9110947, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  1205. Part89.Orientation = Vector3.new(0, 90.1399994, 0)
  1206. Part89.Position = Vector3.new(-14.5524807, 4.76510477, -21.9110947)
  1207. Part89.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  1208. Part89.Color = Color3.new(0.756863, 0.745098, 0.258824)
  1209. Part89.Size = Vector3.new(3.32467079, 3.12577987, 3.12577701)
  1210. Part89.BackParamA = -99999
  1211. Part89.BackParamB = 99999
  1212. Part89.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  1213. Part89.BottomParamA = -99999
  1214. Part89.BottomParamB = 99999
  1215. Part89.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  1216. Part89.BrickColor = BrickColor.new("Olive")
  1217. Part89.CanCollide = false
  1218. Part89.Elasticity = 1
  1219. Part89.Friction = 2
  1220. Part89.FrontParamA = -99999
  1221. Part89.FrontParamB = 99999
  1222. Part89.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  1223. Part89.LeftParamA = -99999
  1224. Part89.LeftParamB = 99999
  1225. Part89.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  1226. Part89.Material = Enum.Material.Fabric
  1227. Part89.RightParamA = -99999
  1228. Part89.RightParamB = 99999
  1229. Part89.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  1230. Part89.TopParamA = -99999
  1231. Part89.TopParamB = 99999
  1232. Part89.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  1233. Part89.brickColor = BrickColor.new("Olive")
  1234. Part89.FormFactor = Enum.FormFactor.Custom
  1235. Part89.formFactor = Enum.FormFactor.Custom
  1236. SpecialMesh90.Parent = Part89
  1237. SpecialMesh90.MeshId = "http://www.roblox.com/asset/?id=19999257"
  1238. SpecialMesh90.Scale = Vector3.new(1.5, 1.5, 1.5)
  1239. SpecialMesh90.TextureId = "rbxassetid://139761620"
  1240. SpecialMesh90.MeshType = Enum.MeshType.FileMesh
  1241. Camera91.Name = "ThumbnailCamera"
  1242. Camera91.Parent = Hat88
  1243. Camera91.CFrame = CFrame.new(1.98147953, 1.4764576, -3.35099077, -0.830983698, -0.0552478395, 0.553546607, -3.7252903e-09, 0.995056272, 0.0993135944, -0.556296825, 0.0825279802, -0.826875448)
  1244. Camera91.CoordinateFrame = CFrame.new(1.98147953, 1.4764576, -3.35099077, -0.830983698, -0.0552478395, 0.553546607, -3.7252903e-09, 0.995056272, 0.0993135944, -0.556296825, 0.0825279802, -0.826875448)
  1245. Camera91.FieldOfView = 20
  1246. Camera91.Focus = CFrame.new(0.874386668, 1.27783048, -1.69724047, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1247. Camera91.focus = CFrame.new(0.874386668, 1.27783048, -1.69724047, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1248. Sound92.Name = "Squidward All Star"
  1249. Sound92.Parent = Model0
  1250. Sound92.Looped = true
  1251. Sound92.Playing = true
  1252. Sound92.SoundId = "rbxassetid://863058858"
  1253. Script93.Name = "Respawn"
  1254. Script93.Parent = Model0
  1255. table.insert(cors,sandbox(Script93,function()
  1256. name="Humanoid"
  1257.  
  1258. robo=script.Parent:clone()
  1259.  
  1260. while true do
  1261.     wait(1)
  1262.     if script.Parent.Humanoid.Health<1 then
  1263.         robot=robo:clone()
  1264.         robot.Parent=script.Parent.Parent
  1265.         robot:makeJoints()
  1266.         script.Parent:remove()
  1267.     end
  1268. end
  1269.        
  1270.  
  1271.  
  1272.  
  1273. end))
  1274. Script94.Parent = Model0
  1275. table.insert(cors,sandbox(Script94,function()
  1276. local larm = script.Parent:FindFirstChild("HumanoidRootPart")
  1277. local rarm = script.Parent:FindFirstChild("HumanoidRootPart")
  1278.  
  1279. function findNearestTorso(pos)
  1280.     local list = game.Workspace:children()
  1281.     local torso = nil
  1282.     local dist = 10000
  1283.     local temp = nil
  1284.     local human = nil
  1285.     local temp2 = nil
  1286.     for x = 1, #list do
  1287.         temp2 = list[x]
  1288.         if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  1289.             temp = temp2:findFirstChild("HumanoidRootPart")
  1290.             human = temp2:findFirstChild("Humanoid")
  1291.             if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  1292.                 if (temp.Position - pos).magnitude < dist then
  1293.                     torso = temp
  1294.                     dist = (temp.Position - pos).magnitude
  1295.                 end
  1296.             end
  1297.         end
  1298.     end
  1299.     return torso
  1300. end
  1301.  
  1302.  
  1303.  
  1304.  
  1305. while true do
  1306.     wait(1)
  1307.     local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
  1308.     if target ~= nil then
  1309.         script.Parent.Zombie:MoveTo(target.Position, target)
  1310.     end
  1311.  
  1312. end
  1313.  
  1314. end))
  1315. Script95.Parent = Model0
  1316. table.insert(cors,sandbox(Script95,function()
  1317. local larm = script.Parent:FindFirstChild("Left Arm")
  1318. local rarm = script.Parent:FindFirstChild("Right Arm")
  1319.  
  1320. function findNearestTorso(pos)
  1321.     local list = game.Workspace:children()
  1322.     local torso = nil
  1323.     local dist = 1000
  1324.     local temp = nil
  1325.     local human = nil
  1326.     local temp2 = nil
  1327.     for x = 1, #list do
  1328.         temp2 = list[x]
  1329.         if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  1330.             temp = temp2:findFirstChild("Torso")
  1331.             human = temp2:findFirstChild("Humanoid")
  1332.             if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  1333.                 if (temp.Position - pos).magnitude < dist then
  1334.                     torso = temp
  1335.                     dist = (temp.Position - pos).magnitude
  1336.                 end
  1337.             end
  1338.         end
  1339.     end
  1340.     return torso
  1341. end
  1342.  
  1343.  
  1344.  
  1345.  
  1346. while true do
  1347.     wait(math.random(1,5))
  1348.     --local target = findNearestTorso(script.Parent.Torso.Position)
  1349.     --if target ~= nil then
  1350.     --  script.Parent.Zombie:MoveTo(target.Position, target)
  1351.     --end
  1352.  
  1353.     script.Parent.Humanoid:MoveTo(Vector3.new(math.random(-100,100),0,math.random(-100,100)), game.Workspace.Base)
  1354.    
  1355.  
  1356. end
  1357.  
  1358. end))
  1359. Script96.Parent = Model0
  1360. table.insert(cors,sandbox(Script96,function()
  1361. local larm = script.Parent:FindFirstChild("Left Arm")
  1362. local rarm = script.Parent:FindFirstChild("Right Arm")
  1363.  
  1364. function findNearestTorso(pos)
  1365.     local list = game.Workspace:children()
  1366.     local torso = nil
  1367.     local dist = 1000
  1368.     local temp = nil
  1369.     local human = nil
  1370.     local temp2 = nil
  1371.     for x = 1, #list do
  1372.         temp2 = list[x]
  1373.         if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  1374.             temp = temp2:findFirstChild("Right Arm")
  1375.             human = temp2:findFirstChild("Humanoid")
  1376.             if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  1377.                 if (temp.Position - pos).magnitude < dist then
  1378.                     torso = temp
  1379.                     dist = (temp.Position - pos).magnitude
  1380.                 end
  1381.             end
  1382.         end
  1383.     end
  1384.     return torso
  1385. end
  1386.  
  1387.  
  1388.  
  1389.  
  1390. while true do
  1391.     wait(math.random(1,5))
  1392.     local target = findNearestTorso(script.Parent.Torso.Position)
  1393.     if target ~= nil then
  1394.         script.Parent.Humanoid:MoveTo(target.Position, target)
  1395.     end
  1396.  
  1397. end
  1398.  
  1399. end))
  1400. Script97.Name = "Sound"
  1401. Script97.Parent = Model0
  1402. table.insert(cors,sandbox(Script97,function()
  1403. ---This server script creates the sounds and also exists so that it can be easily copied into an NPC and create sounds for that NPC.
  1404. --Remove the local script if you copy this into an NPC.
  1405.  
  1406. function waitForChild(parent, childName)
  1407.     local child = parent:findFirstChild(childName)
  1408.     if child then return child end
  1409.     while true do
  1410.         child = parent.ChildAdded:wait()
  1411.         if child.Name==childName then return child end
  1412.     end
  1413. end
  1414.  
  1415. function newSound(name, id)
  1416.     local sound = Instance.new("Sound")
  1417.     sound.SoundId = id
  1418.     sound.Name = name
  1419.     sound.archivable = false
  1420.     sound.Parent = script.Parent.Head
  1421.     return sound
  1422. end
  1423.  
  1424. -- declarations
  1425.  
  1426. local sGettingUp = newSound("GettingUp", "rbxasset://sounds/action_get_up.mp3")
  1427. local sDied = newSound("Died", "rbxasset://sounds/uuhhh.mp3")
  1428. local sFreeFalling = newSound("FreeFalling", "rbxasset://sounds/action_falling.mp3")
  1429. local sJumping = newSound("Jumping", "rbxasset://sounds/action_jump.mp3")
  1430. local sLanding = newSound("Landing", "rbxasset://sounds/action_jump_land.mp3")
  1431. local sSplash = newSound("Splash", "rbxasset://sounds/impact_water.mp3")
  1432. local sRunning = newSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3")
  1433. sRunning.Looped = true
  1434. local sSwimming = newSound("Swimming", "rbxasset://sounds/action_swim.mp3")
  1435. sSwimming.Looped = true
  1436. local sClimbing = newSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3")
  1437. sClimbing.Looped = true
  1438.  
  1439. local Figure = script.Parent
  1440. local Head = waitForChild(Figure, "Head")
  1441. local Humanoid = waitForChild(Figure, "Humanoid")
  1442. local hasPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
  1443. local filteringEnabled = game.Workspace.FilteringEnabled
  1444.  
  1445. local prevState = "None"
  1446.  
  1447. -- functions
  1448.  
  1449. function onDied()
  1450.     stopLoopedSounds()
  1451.     sDied:Play()
  1452. end
  1453.  
  1454. local fallCount = 0
  1455. local fallSpeed = 0
  1456. function onStateFall(state, sound)
  1457.     fallCount = fallCount + 1
  1458.     if state then
  1459.         sound.Volume = 0
  1460.         sound:Play()
  1461.         Spawn( function()
  1462.             local t = 0
  1463.             local thisFall = fallCount
  1464.             while t < 1.5 and fallCount == thisFall do
  1465.                 local vol = math.max(t - 0.3 , 0)
  1466.                 sound.Volume = vol
  1467.                 wait(0.1)
  1468.                 t = t + 0.1
  1469.             end
  1470.         end)
  1471.     else
  1472.         sound:Stop()
  1473.     end
  1474.     fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
  1475. end
  1476.  
  1477.  
  1478. function onStateNoStop(state, sound)
  1479.     if state then
  1480.         sound:Play()
  1481.     end
  1482. end
  1483.  
  1484.  
  1485. function onRunning(speed)
  1486.     sClimbing:Stop()
  1487.     sSwimming:Stop()
  1488.     if (prevState == "FreeFall" and fallSpeed > 0.1) then
  1489.         local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
  1490.         sLanding.Volume = vol
  1491.         sLanding:Play()
  1492.         fallSpeed = 0
  1493.     end
  1494.     if speed>0.5 then
  1495.         sRunning:Play()
  1496.         sRunning.Pitch = speed / 8.0
  1497.     else
  1498.         sRunning:Stop()
  1499.     end
  1500.     prevState = "Run"
  1501. end
  1502.  
  1503. function onSwimming(speed)
  1504.     if (prevState ~= "Swim" and speed > 0.1) then
  1505.         local volume = math.min(1.0, speed / 350)
  1506.         sSplash.Volume = volume
  1507.         sSplash:Play()
  1508.         prevState = "Swim"
  1509.     end
  1510.     sClimbing:Stop()
  1511.     sRunning:Stop()
  1512.     sSwimming.Pitch = 1.6
  1513.     sSwimming:Play()
  1514. end
  1515.  
  1516. function onClimbing(speed)
  1517.     sRunning:Stop()
  1518.     sSwimming:Stop()   
  1519.     if speed>0.01 then
  1520.         sClimbing:Play()
  1521.         sClimbing.Pitch = speed / 5.5
  1522.     else
  1523.         sClimbing:Stop()
  1524.     end
  1525.     prevState = "Climb"
  1526. end
  1527. -- connect up
  1528.  
  1529. function stopLoopedSounds()
  1530.     sRunning:Stop()
  1531.     sClimbing:Stop()
  1532.     sSwimming:Stop()
  1533. end
  1534.  
  1535. if hasPlayer == nil then
  1536.     Humanoid.Died:connect(onDied)
  1537.     Humanoid.Running:connect(onRunning)
  1538.     Humanoid.Swimming:connect(onSwimming)
  1539.     Humanoid.Climbing:connect(onClimbing)
  1540.     Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
  1541.     Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
  1542.     Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
  1543.     Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
  1544.     Humanoid.StateChanged:connect(function(old, new)
  1545.         if not (new.Name == "Dead" or
  1546.                 new.Name == "Running" or
  1547.                 new.Name == "RunningNoPhysics" or
  1548.                 new.Name == "Swimming" or
  1549.                 new.Name == "Jumping" or
  1550.                 new.Name == "GettingUp" or
  1551.                 new.Name == "Freefall" or
  1552.                 new.Name == "FallingDown") then
  1553.             stopLoopedSounds()
  1554.         end
  1555.     end)
  1556. end
  1557.  
  1558. end))
  1559. LocalScript98.Name = "LocalSound"
  1560. LocalScript98.Parent = Script97
  1561. table.insert(cors,sandbox(LocalScript98,function()
  1562. --This local script will run only for the player whos character it is in. It's changes to the sounds will replicate as they are changes to the character.
  1563. -- util
  1564.  
  1565. function waitForChild(parent, childName)
  1566.     local child = parent:findFirstChild(childName)
  1567.     if child then return child end
  1568.     while true do
  1569.         child = parent.ChildAdded:wait()
  1570.         if child.Name==childName then return child end
  1571.     end
  1572. end
  1573.  
  1574.  
  1575. -- declarations
  1576.  
  1577. local Figure = script.Parent.Parent
  1578. local Head = waitForChild(Figure, "Head")
  1579. local Humanoid = waitForChild(Figure, "Humanoid")
  1580.  
  1581. local sGettingUp = waitForChild(Head, "GettingUp")
  1582. local sDied = waitForChild(Head, "Died")
  1583. local sFreeFalling = waitForChild(Head, "FreeFalling")
  1584. local sJumping = waitForChild(Head, "Jumping")
  1585. local sLanding = waitForChild(Head, "Landing")
  1586. local sSplash = waitForChild(Head, "Splash")
  1587. local sRunning = waitForChild(Head, "Running")
  1588. sRunning.Looped = true
  1589. local sSwimming = waitForChild(Head, "Swimming")
  1590. sSwimming.Looped = true
  1591. local sClimbing =waitForChild(Head, "Climbing")
  1592. sClimbing.Looped = true
  1593.  
  1594. local prevState = "None"
  1595.  
  1596. -- functions
  1597.  
  1598. function onDied()
  1599.     stopLoopedSounds()
  1600.     sDied:Play()
  1601. end
  1602.  
  1603. local fallCount = 0
  1604. local fallSpeed = 0
  1605. function onStateFall(state, sound)
  1606.     fallCount = fallCount + 1
  1607.     if state then
  1608.         sound.Volume = 0
  1609.         sound:Play()
  1610.         Spawn( function()
  1611.             local t = 0
  1612.             local thisFall = fallCount
  1613.             while t < 1.5 and fallCount == thisFall do
  1614.                 local vol = math.max(t - 0.3 , 0)
  1615.                 sound.Volume = vol
  1616.                 wait(0.1)
  1617.                 t = t + 0.1
  1618.             end
  1619.         end)
  1620.     else
  1621.         sound:Stop()
  1622.     end
  1623.     fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
  1624. end
  1625.  
  1626.  
  1627. function onStateNoStop(state, sound)
  1628.     if state then
  1629.         sound:Play()
  1630.     end
  1631. end
  1632.  
  1633.  
  1634. function onRunning(speed)
  1635.     sClimbing:Stop()
  1636.     sSwimming:Stop()
  1637.     if (prevState == "FreeFall" and fallSpeed > 0.1) then
  1638.         local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
  1639.         sLanding.Volume = vol
  1640.         sLanding:Play()
  1641.         fallSpeed = 0
  1642.     end
  1643.     if speed>0.5 then
  1644.         sRunning:Play()
  1645.         sRunning.Pitch = speed / 8.0
  1646.     else
  1647.         sRunning:Stop()
  1648.     end
  1649.     prevState = "Run"
  1650. end
  1651.  
  1652. function onSwimming(speed)
  1653.     if (prevState ~= "Swim" and speed > 0.1) then
  1654.         local volume = math.min(1.0, speed / 350)
  1655.         sSplash.Volume = volume
  1656.         sSplash:Play()
  1657.         prevState = "Swim"
  1658.     end
  1659.     sClimbing:Stop()
  1660.     sRunning:Stop()
  1661.     sSwimming.Pitch = 1.6
  1662.     sSwimming:Play()
  1663. end
  1664.  
  1665. function onClimbing(speed)
  1666.     sRunning:Stop()
  1667.     sSwimming:Stop()   
  1668.     if speed>0.01 then
  1669.         sClimbing:Play()
  1670.         sClimbing.Pitch = speed / 5.5
  1671.     else
  1672.         sClimbing:Stop()
  1673.     end
  1674.     prevState = "Climb"
  1675. end
  1676. -- connect up
  1677.  
  1678. function stopLoopedSounds()
  1679.     sRunning:Stop()
  1680.     sClimbing:Stop()
  1681.     sSwimming:Stop()
  1682. end
  1683.  
  1684. Humanoid.Died:connect(onDied)
  1685. Humanoid.Running:connect(onRunning)
  1686. Humanoid.Swimming:connect(onSwimming)
  1687. Humanoid.Climbing:connect(onClimbing)
  1688. Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
  1689. Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
  1690. Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
  1691. Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
  1692. Humanoid.StateChanged:connect(function(old, new)
  1693.     if not (new.Name == "Dead" or
  1694.             new.Name == "Running" or
  1695.             new.Name == "RunningNoPhysics" or
  1696.             new.Name == "Swimming" or
  1697.             new.Name == "Jumping" or
  1698.             new.Name == "GettingUp" or
  1699.             new.Name == "Freefall" or
  1700.             new.Name == "FallingDown") then
  1701.         stopLoopedSounds()
  1702.     end
  1703. end)
  1704.  
  1705.  
  1706. end))
  1707. Script99.Parent = Model0
  1708. table.insert(cors,sandbox(Script99,function()
  1709. script.Parent:Play()
  1710. end))
  1711. Sound100.Name = "Music"
  1712. Sound100.Parent = Model0
  1713. Sound100.Looped = true
  1714. Sound100.SoundId = "rbxassetid://150771181"
  1715. Script101.Name = "Kill Script"
  1716. Script101.Parent = Model0
  1717. table.insert(cors,sandbox(Script101,function()
  1718. function wthomgblah(nose)
  1719. humanoid = nose.Parent:findFirstChild("Humanoid")
  1720. if humanoid ~= nil then
  1721. humanoid.MaxHealth = 0
  1722. humanoid.Health = 0
  1723. if humanoid.Parent ~= workspace then
  1724. humanoid.Parent:BreakJoints()
  1725. script.Parent.Scream:Play()
  1726. end
  1727. end
  1728. end
  1729. script.Parent.Touched:connect(wthomgblah)
  1730.  
  1731.  
  1732. end))
  1733. for i,v in pairs(mas:GetChildren()) do
  1734.     v.Parent = workspace
  1735.     pcall(function() v:MakeJoints() end)
  1736. end
  1737. mas:Destroy()
  1738. for i,v in pairs(cors) do
  1739.     spawn(function()
  1740.         pcall(v)
  1741.     end)
  1742. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement