Advertisement
BNutty07

Not my script sorrys

Jul 7th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.06 KB | None | 0 0
  1. --Created with PenguinAnonymous's compiler
  2. --PenguinAnonymous is not responsible for damages caused to your game
  3. --This plugin does not remove things
  4. --PenguinAnonymous cannot be held resonsible for manual deletion for the purpose of testing
  5. --Keep in mind, any items that cause errors in compilation will be skipped and documented within the last line of the disclaimer comments
  6. --Thank you for using my plugin and enjoy :)
  7. --It is free to use
  8. --If you use this plugin to create your own, please give me credit
  9. --Z_V edited my plugin to look like his own and published it without giving me credit, and that makes me very angry
  10. --Errors:
  11. local runDummyScript = function(f,scri)
  12. local oldenv = getfenv(f)
  13. local newenv = setmetatable({}, {
  14. __index = function(_, k)
  15. if k:lower() == 'script' then
  16. return scri
  17. else
  18. return oldenv[k]
  19. end
  20. end
  21. })
  22. setfenv(f, newenv)
  23. ypcall(function() f() end)
  24. end
  25. cors = {}
  26. mas = Instance.new("Model",game:GetService("Lighting"))
  27. mas.Name = "CompiledModel"
  28. o1 = Instance.new("Model")
  29. o2 = Instance.new("Part")
  30. o3 = Instance.new("Decal")
  31. o4 = Instance.new("Fire")
  32. o5 = Instance.new("Motor6D")
  33. o6 = Instance.new("Motor6D")
  34. o7 = Instance.new("Motor6D")
  35. o8 = Instance.new("Motor6D")
  36. o9 = Instance.new("Motor6D")
  37. o10 = Instance.new("Part")
  38. o11 = Instance.new("Decal")
  39. o12 = Instance.new("Part")
  40. o13 = Instance.new("Decal")
  41. o14 = Instance.new("Part")
  42. o15 = Instance.new("Decal")
  43. o16 = Instance.new("Part")
  44. o17 = Instance.new("Decal")
  45. o18 = Instance.new("Part")
  46. o19 = Instance.new("SpecialMesh")
  47. o20 = Instance.new("Decal")
  48. o21 = Instance.new("Humanoid")
  49. o22 = Instance.new("CharacterMesh")
  50. o23 = Instance.new("CharacterMesh")
  51. o24 = Instance.new("CharacterMesh")
  52. o25 = Instance.new("CharacterMesh")
  53. o26 = Instance.new("CharacterMesh")
  54. o27 = Instance.new("Script")
  55. o28 = Instance.new("StringValue")
  56. o29 = Instance.new("Animation")
  57. o30 = Instance.new("StringValue")
  58. o31 = Instance.new("Animation")
  59. o32 = Instance.new("StringValue")
  60. o33 = Instance.new("Animation")
  61. o34 = Instance.new("NumberValue")
  62. o35 = Instance.new("Animation")
  63. o36 = Instance.new("NumberValue")
  64. o37 = Instance.new("StringValue")
  65. o38 = Instance.new("Animation")
  66. o39 = Instance.new("StringValue")
  67. o40 = Instance.new("Animation")
  68. o41 = Instance.new("StringValue")
  69. o42 = Instance.new("Animation")
  70. o43 = Instance.new("StringValue")
  71. o44 = Instance.new("Animation")
  72. o45 = Instance.new("StringValue")
  73. o46 = Instance.new("Animation")
  74. o47 = Instance.new("Script")
  75. o48 = Instance.new("Script")
  76. o49 = Instance.new("Script")
  77. o1.Name = "SCP-457"
  78. o1.Parent = mas
  79. o2.Name = "Torso"
  80. o2.Parent = o1
  81. o2.Position = Vector3.new(-28.3217468, 3.60001993, -82.9443817)
  82. o2.CanCollide = false
  83. o2.Size = Vector3.new(2.39999223, 2.39999223, 1.19999611)
  84. o2.CFrame = CFrame.new(-28.3217468, 3.60001993, -82.9443817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  85. o2.BottomSurface = Enum.SurfaceType.Smooth
  86. o2.TopSurface = Enum.SurfaceType.Smooth
  87. o2.Position = Vector3.new(-28.3217468, 3.60001993, -82.9443817)
  88. o3.Parent = o2
  89. o3.Texture = "http://www.roblox.com/asset/?id=100216385"
  90. o4.Parent = o2
  91. o4.Size = 30
  92. o4.Heat = 25
  93. o4.SecondaryColor = Color3.new(0.545098, 0.313726, 0.215686)
  94. o5.Name = "Left Hip"
  95. o5.Parent = o2
  96. o5.C0 = CFrame.new(-1.19999611, -1.19999611, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  97. o5.C1 = CFrame.new(-0.599998057, 1.19999611, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  98. o5.Part0 = o2
  99. o5.Part1 = o10
  100. o5.MaxVelocity = 0.10000000149012
  101. o6.Name = "Right Hip"
  102. o6.Parent = o2
  103. o6.C0 = CFrame.new(1.19999611, -1.19999611, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  104. o6.C1 = CFrame.new(0.599998057, 1.19999611, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  105. o6.Part0 = o2
  106. o6.Part1 = o12
  107. o6.MaxVelocity = 0.10000000149012
  108. o7.Name = "Left Shoulder"
  109. o7.Parent = o2
  110. o7.C0 = CFrame.new(-1.19999611, 0.599998057, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  111. o7.C1 = CFrame.new(0.599998057, 0.599998057, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  112. o7.Part0 = o2
  113. o7.Part1 = o14
  114. o7.MaxVelocity = 0.10000000149012
  115. o8.Name = "Right Shoulder"
  116. o8.Parent = o2
  117. o8.C0 = CFrame.new(1.19999611, 0.599998057, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  118. o8.C1 = CFrame.new(-0.599998057, 0.599998057, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  119. o8.Part0 = o2
  120. o8.Part1 = o16
  121. o8.MaxVelocity = 0.10000000149012
  122. o9.Name = "Neck"
  123. o9.Parent = o2
  124. o9.C0 = CFrame.new(0, 1.19999611, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  125. o9.C1 = CFrame.new(0, -0.599998057, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  126. o9.Part0 = o2
  127. o9.Part1 = o18
  128. o9.MaxVelocity = 0.10000000149012
  129. o10.Name = "Left Leg"
  130. o10.Parent = o1
  131. o10.Position = Vector3.new(-28.9217453, 1.20002794, -82.9443817)
  132. o10.CanCollide = false
  133. o10.Size = Vector3.new(1.19999611, 2.39999223, 1.19999611)
  134. o10.CFrame = CFrame.new(-28.9217453, 1.20002794, -82.9443817, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
  135. o10.BottomSurface = Enum.SurfaceType.Smooth
  136. o10.TopSurface = Enum.SurfaceType.Smooth
  137. o10.Position = Vector3.new(-28.9217453, 1.20002794, -82.9443817)
  138. o11.Parent = o10
  139. o11.Texture = "http://www.roblox.com/asset/?id=100216385"
  140. o12.Name = "Right Leg"
  141. o12.Parent = o1
  142. o12.Position = Vector3.new(-27.7217484, 1.20002794, -82.9443817)
  143. o12.CanCollide = false
  144. o12.Size = Vector3.new(1.19999611, 2.39999223, 1.19999611)
  145. o12.CFrame = CFrame.new(-27.7217484, 1.20002794, -82.9443817, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
  146. o12.BottomSurface = Enum.SurfaceType.Smooth
  147. o12.TopSurface = Enum.SurfaceType.Smooth
  148. o12.Position = Vector3.new(-27.7217484, 1.20002794, -82.9443817)
  149. o13.Parent = o12
  150. o13.Texture = "http://www.roblox.com/asset/?id=100216385"
  151. o14.Name = "Left Arm"
  152. o14.Parent = o1
  153. o14.Position = Vector3.new(-30.1217403, 3.60001993, -82.9443817)
  154. o14.CanCollide = false
  155. o14.Size = Vector3.new(1.19999611, 2.39999223, 1.19999611)
  156. o14.CFrame = CFrame.new(-30.1217403, 3.60001993, -82.9443817, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
  157. o14.BottomSurface = Enum.SurfaceType.Smooth
  158. o14.TopSurface = Enum.SurfaceType.Smooth
  159. o14.Position = Vector3.new(-30.1217403, 3.60001993, -82.9443817)
  160. o15.Parent = o14
  161. o15.Texture = "http://www.roblox.com/asset/?id=100216385"
  162. o16.Name = "Right Arm"
  163. o16.Parent = o1
  164. o16.Position = Vector3.new(-26.5217533, 3.60001993, -82.9443817)
  165. o16.CanCollide = false
  166. o16.Size = Vector3.new(1.19999611, 2.39999223, 1.19999611)
  167. o16.CFrame = CFrame.new(-26.5217533, 3.60001993, -82.9443817, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
  168. o16.BottomSurface = Enum.SurfaceType.Smooth
  169. o16.TopSurface = Enum.SurfaceType.Smooth
  170. o16.Position = Vector3.new(-26.5217533, 3.60001993, -82.9443817)
  171. o17.Parent = o16
  172. o17.Texture = "http://www.roblox.com/asset/?id=100216385"
  173. o18.Name = "Head"
  174. o18.Parent = o1
  175. o18.Position = Vector3.new(-28.3217468, 5.40001392, -82.9443817)
  176. o18.Size = Vector3.new(2.39999223, 1.19999611, 1.19999611)
  177. o18.CFrame = CFrame.new(-28.3217468, 5.40001392, -82.9443817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  178. o18.BottomSurface = Enum.SurfaceType.Smooth
  179. o18.TopSurface = Enum.SurfaceType.Smooth
  180. o18.Position = Vector3.new(-28.3217468, 5.40001392, -82.9443817)
  181. o19.Parent = o18
  182. o19.MeshId = "rbxassetid://83009121"
  183. o19.Scale = Vector3.new(1.49999523, 1.49999523, 1.49999523)
  184. o19.MeshType = Enum.MeshType.FileMesh
  185. o20.Parent = o18
  186. o20.Texture = "http://www.roblox.com/asset/?id=100216385"
  187. o21.Parent = o1
  188. o21.RightLeg = o12
  189. o21.LeftLeg = o10
  190. o21.Torso = o2
  191. o21.WalkSpeed = 5
  192. o22.Parent = o1
  193. o22.MeshId = 27111419
  194. o22.BodyPart = Enum.BodyPart.LeftArm
  195. o23.Parent = o1
  196. o23.MeshId = 27111864
  197. o23.BodyPart = Enum.BodyPart.RightArm
  198. o24.Parent = o1
  199. o24.MeshId = 27111857
  200. o24.BodyPart = Enum.BodyPart.LeftLeg
  201. o25.Parent = o1
  202. o25.MeshId = 27111882
  203. o25.BodyPart = Enum.BodyPart.RightLeg
  204. o26.Parent = o1
  205. o26.MeshId = 27111894
  206. o26.BodyPart = Enum.BodyPart.Torso
  207. o27.Name = "AnimateSauce"
  208. o27.Parent = o1
  209. table.insert(cors,coroutine.create(function()
  210. wait()
  211. runDummyScript(function()
  212. function waitForChild(parent, childName)
  213. local child = parent:findFirstChild(childName)
  214. if child then return child end
  215. while true do
  216. child = parent.ChildAdded:wait()
  217. if child.Name==childName then return child end
  218. end
  219. end
  220. local Figure = script.Parent
  221. local Torso = waitForChild(Figure, "Torso")
  222. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  223. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  224. local RightHip = waitForChild(Torso, "Right Hip")
  225. local LeftHip = waitForChild(Torso, "Left Hip")
  226. local Neck = waitForChild(Torso, "Neck")
  227. local Humanoid;
  228. for _,Child in pairs(Figure:GetChildren())do
  229. if Child and Child.ClassName=="Humanoid"then
  230. Humanoid=Child;
  231. end;
  232. end;
  233. local pose = "Standing"
  234. local currentAnim = ""
  235. local currentAnimInstance = nil
  236. local currentAnimTrack = nil
  237. local currentAnimKeyframeHandler = nil
  238. local currentAnimSpeed = 1.0
  239. local animTable = {}
  240. local animNames = {
  241. idle = {
  242. { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
  243. { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
  244. },
  245. walk = {
  246. { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
  247. },
  248. run = {
  249. { id = "run.xml", weight = 10 }
  250. },
  251. jump = {
  252. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  253. },
  254. fall = {
  255. { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
  256. },
  257. climb = {
  258. { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
  259. },
  260. sit = {
  261. { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
  262. },
  263. toolnone = {
  264. { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
  265. },
  266. toolslash = {
  267. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  268. --{ id = "slash.xml", weight = 10 }
  269. },
  270. toollunge = {
  271. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  272. },
  273. wave = {
  274. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  275. },
  276. point = {
  277. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  278. },
  279. dance1 = {
  280. { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
  281. { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
  282. { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
  283. },
  284. dance2 = {
  285. { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
  286. { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
  287. { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
  288. },
  289. dance3 = {
  290. { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
  291. { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
  292. { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
  293. },
  294. laugh = {
  295. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  296. },
  297. cheer = {
  298. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  299. },
  300. }
  301. local dances = {"dance1", "dance2", "dance3"}
  302.  
  303. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  304. local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  305.  
  306. function configureAnimationSet(name, fileList)
  307. if (animTable[name] ~= nil) then
  308. for _, connection in pairs(animTable[name].connections) do
  309. connection:disconnect()
  310. end
  311. end
  312. animTable[name] = {}
  313. animTable[name].count = 0
  314. animTable[name].totalWeight = 0
  315. animTable[name].connections = {}
  316.  
  317. -- check for config values
  318. local config = script:FindFirstChild(name)
  319. if (config ~= nil) then
  320. --print("Loading anims " .. name)
  321. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  322. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  323. local idx = 1
  324. for _, childPart in pairs(config:GetChildren()) do
  325. if (childPart:IsA("Animation")) then
  326. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  327. animTable[name][idx] = {}
  328. animTable[name][idx].anim = childPart
  329. local weightObject = childPart:FindFirstChild("Weight")
  330. if (weightObject == nil) then
  331. animTable[name][idx].weight = 1
  332. else
  333. animTable[name][idx].weight = weightObject.Value
  334. end
  335. animTable[name].count = animTable[name].count + 1
  336. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  337. --print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  338. idx = idx + 1
  339. end
  340. end
  341. end
  342.  
  343. -- fallback to defaults
  344. if (animTable[name].count <= 0) then
  345. for idx, anim in pairs(fileList) do
  346. animTable[name][idx] = {}
  347. animTable[name][idx].anim = Instance.new("Animation")
  348. animTable[name][idx].anim.Name = name
  349. animTable[name][idx].anim.AnimationId = anim.id
  350. animTable[name][idx].weight = anim.weight
  351. animTable[name].count = animTable[name].count + 1
  352. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  353. --print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  354. end
  355. end
  356. end
  357.  
  358. -- Setup animation objects
  359. function scriptChildModified(child)
  360. local fileList = animNames[child.Name]
  361. if (fileList ~= nil) then
  362. configureAnimationSet(child.Name, fileList)
  363. end
  364. end
  365.  
  366. script.ChildAdded:connect(scriptChildModified)
  367. script.ChildRemoved:connect(scriptChildModified)
  368.  
  369.  
  370. for name, fileList in pairs(animNames) do
  371. configureAnimationSet(name, fileList)
  372. end
  373.  
  374. -- ANIMATION
  375.  
  376. -- declarations
  377. local toolAnim = "None"
  378. local toolAnimTime = 0
  379.  
  380. local jumpAnimTime = 0
  381. local jumpAnimDuration = 0.3
  382.  
  383. local toolTransitionTime = 0.1
  384. local fallTransitionTime = 0.3
  385. local jumpMaxLimbVelocity = 0.75
  386.  
  387. -- functions
  388.  
  389. function stopAllAnimations()
  390. local oldAnim = currentAnim
  391.  
  392. -- return to idle if finishing an emote
  393. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  394. oldAnim = "idle"
  395. end
  396.  
  397. currentAnim = ""
  398. currentAnimInstance = nil
  399. if (currentAnimKeyframeHandler ~= nil) then
  400. currentAnimKeyframeHandler:disconnect()
  401. end
  402.  
  403. if (currentAnimTrack ~= nil) then
  404. currentAnimTrack:Stop()
  405. currentAnimTrack:Destroy()
  406. currentAnimTrack = nil
  407. end
  408. return oldAnim
  409. end
  410.  
  411. function setAnimationSpeed(speed)
  412. if speed ~= currentAnimSpeed then
  413. currentAnimSpeed = speed
  414. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  415. end
  416. end
  417.  
  418. function keyFrameReachedFunc(frameName)
  419. if (frameName == "End") then
  420.  
  421. local repeatAnim = currentAnim
  422. -- return to idle if finishing an emote
  423. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  424. repeatAnim = "idle"
  425. end
  426.  
  427. local animSpeed = currentAnimSpeed
  428. playAnimation(repeatAnim, 0.0, Humanoid)
  429. setAnimationSpeed(animSpeed)
  430. end
  431. end
  432.  
  433. -- Preload animations
  434. function playAnimation(animName, transitionTime, humanoid)
  435.  
  436. local roll = math.random(1, animTable[animName].totalWeight)
  437. local origRoll = roll
  438. local idx = 1
  439. while (roll > animTable[animName][idx].weight) do
  440. roll = roll - animTable[animName][idx].weight
  441. idx = idx + 1
  442. end
  443. --print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  444. local anim = animTable[animName][idx].anim
  445. -- switch animation
  446. if (anim ~= currentAnimInstance) then
  447. if (currentAnimTrack ~= nil) then
  448. currentAnimTrack:Stop(transitionTime)
  449. currentAnimTrack:Destroy()
  450. end
  451. currentAnimSpeed = 1.0
  452. -- load it to the humanoid; get AnimationTrack
  453. currentAnimTrack = humanoid:LoadAnimation(anim)
  454. -- play the animation
  455. currentAnimTrack:Play(transitionTime)
  456. currentAnim = animName
  457. currentAnimInstance = anim
  458. -- set up keyframe name triggers
  459. if (currentAnimKeyframeHandler ~= nil) then
  460. currentAnimKeyframeHandler:disconnect()
  461. end
  462. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  463. end
  464. end
  465. -------------------------------------------------------------------------------------------
  466. -------------------------------------------------------------------------------------------
  467. local toolAnimName = ""
  468. local toolAnimTrack = nil
  469. local toolAnimInstance = nil
  470. local currentToolAnimKeyframeHandler = nil
  471. function toolKeyFrameReachedFunc(frameName)
  472. if (frameName == "End") then
  473. --print("Keyframe : ".. frameName)
  474. playToolAnimation(toolAnimName, 0.0, Humanoid)
  475. end
  476. end
  477. function playToolAnimation(animName, transitionTime, humanoid)
  478. local roll = math.random(1, animTable[animName].totalWeight)
  479. local origRoll = roll
  480. local idx = 1
  481. while (roll > animTable[animName][idx].weight) do
  482. roll = roll - animTable[animName][idx].weight
  483. idx = idx + 1
  484. end
  485. --print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  486. local anim = animTable[animName][idx].anim
  487. if (toolAnimInstance ~= anim) then
  488. if (toolAnimTrack ~= nil) then
  489. toolAnimTrack:Stop()
  490. toolAnimTrack:Destroy()
  491. transitionTime = 0
  492. end
  493. -- load it to the humanoid; get AnimationTrack
  494. toolAnimTrack = humanoid:LoadAnimation(anim)
  495. -- play the animation
  496. toolAnimTrack:Play(transitionTime)
  497. toolAnimName = animName
  498. toolAnimInstance = anim
  499. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  500. end
  501. end
  502. function stopToolAnimations()
  503. local oldAnim = toolAnimName
  504. if (currentToolAnimKeyframeHandler ~= nil) then
  505. currentToolAnimKeyframeHandler:disconnect()
  506. end
  507. toolAnimName = ""
  508. toolAnimInstance = nil
  509. if (toolAnimTrack ~= nil) then
  510. toolAnimTrack:Stop()
  511. toolAnimTrack:Destroy()
  512. toolAnimTrack = nil
  513. end
  514. return oldAnim
  515. end
  516. -------------------------------------------------------------------------------------------
  517. -------------------------------------------------------------------------------------------
  518. function onRunning(speed)
  519. if speed>0.01 then
  520. playAnimation("walk", 0.1, Humanoid)
  521. if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
  522. setAnimationSpeed(speed / 14.5)
  523. end
  524. pose = "Running"
  525. else
  526. playAnimation("idle", 0.1, Humanoid)
  527. pose = "Standing"
  528. end
  529. end
  530. function onDied()
  531. pose = "Dead"
  532. end
  533. function onJumping()
  534. playAnimation("jump", 0.1, Humanoid)
  535. jumpAnimTime = jumpAnimDuration
  536. pose = "Jumping"
  537. end
  538. function onClimbing(speed)
  539. playAnimation("climb", 0.1, Humanoid)
  540. setAnimationSpeed(speed / 12.0)
  541. pose = "Climbing"
  542. end
  543. function onGettingUp()
  544. pose = "GettingUp"
  545. end
  546. function onFreeFall()
  547. if (jumpAnimTime <= 0) then
  548. playAnimation("fall", fallTransitionTime, Humanoid)
  549. end
  550. pose = "FreeFall"
  551. end
  552. function onFallingDown()
  553. pose = "FallingDown"
  554. end
  555. function onSeated()
  556. pose = "Seated"
  557. end
  558. function onPlatformStanding()
  559. pose = "PlatformStanding"
  560. end
  561. function onSwimming(speed)
  562. if speed>0 then
  563. pose = "Running"
  564. else
  565. pose = "Standing"
  566. end
  567. end
  568.  
  569. function getTool()
  570. for _, kid in ipairs(Figure:GetChildren()) do
  571. if kid.className == "Tool" then return kid end
  572. end
  573. return nil
  574. end
  575.  
  576. function getToolAnim(tool)
  577. for _, c in ipairs(tool:GetChildren()) do
  578. if c.Name == "toolanim" and c.className == "StringValue" then
  579. return c
  580. end
  581. end
  582. return nil
  583. end
  584.  
  585. function animateTool()
  586.  
  587. if (toolAnim == "None") then
  588. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  589. return
  590. end
  591.  
  592. if (toolAnim == "Slash") then
  593. playToolAnimation("toolslash", 0, Humanoid)
  594. return
  595. end
  596.  
  597. if (toolAnim == "Lunge") then
  598. playToolAnimation("toollunge", 0, Humanoid)
  599. return
  600. end
  601. end
  602.  
  603. function moveSit()
  604. RightShoulder.MaxVelocity = 0.15
  605. LeftShoulder.MaxVelocity = 0.15
  606. RightShoulder:SetDesiredAngle(3.14 /2)
  607. LeftShoulder:SetDesiredAngle(-3.14 /2)
  608. RightHip:SetDesiredAngle(3.14 /2)
  609. LeftHip:SetDesiredAngle(-3.14 /2)
  610. end
  611.  
  612. local lastTick = 0
  613.  
  614. function move(time)
  615. local amplitude = 1
  616. local frequency = 1
  617. local deltaTime = time - lastTick
  618. lastTick = time
  619.  
  620. local climbFudge = 0
  621. local setAngles = false
  622.  
  623. if (jumpAnimTime > 0) then
  624. jumpAnimTime = jumpAnimTime - deltaTime
  625. end
  626.  
  627. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  628. playAnimation("fall", fallTransitionTime, Humanoid)
  629. elseif (pose == "Seated") then
  630. playAnimation("sit", 0.5, Humanoid)
  631. return
  632. elseif (pose == "Running") then
  633. playAnimation("walk", 0.1, Humanoid)
  634. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  635. stopAllAnimations()
  636. amplitude = 0.1
  637. frequency = 1
  638. setAngles = true
  639. end
  640. if (setAngles) then
  641. local desiredAngle = amplitude * math.sin(time * frequency)
  642. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  643. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  644. RightHip:SetDesiredAngle(-desiredAngle)
  645. LeftHip:SetDesiredAngle(-desiredAngle)
  646. end
  647. -- Tool Animation handling
  648. local tool = getTool()
  649. if tool and tool:FindFirstChild("Handle") then
  650. local animStringValueObject = getToolAnim(tool)
  651. if animStringValueObject then
  652. toolAnim = animStringValueObject.Value
  653. -- message recieved, delete StringValue
  654. animStringValueObject.Parent = nil
  655. toolAnimTime = time + .3
  656. end
  657. if time > toolAnimTime then
  658. toolAnimTime = 0
  659. toolAnim = "None"
  660. end
  661. animateTool()
  662. else
  663. stopToolAnimations()
  664. toolAnim = "None"
  665. toolAnimInstance = nil
  666. toolAnimTime = 0
  667. end
  668. end
  669. -- connect events
  670. Humanoid.Died:connect(onDied)
  671. Humanoid.Running:connect(onRunning)
  672. Humanoid.Jumping:connect(onJumping)
  673. Humanoid.Climbing:connect(onClimbing)
  674. Humanoid.GettingUp:connect(onGettingUp)
  675. Humanoid.FreeFalling:connect(onFreeFall)
  676. Humanoid.FallingDown:connect(onFallingDown)
  677. Humanoid.Seated:connect(onSeated)
  678. Humanoid.PlatformStanding:connect(onPlatformStanding)
  679. Humanoid.Swimming:connect(onSwimming)
  680. local runService = game:GetService("RunService");
  681. playAnimation("idle", 0.1, Humanoid)
  682. pose = "Standing"
  683. while Wait(0)do
  684. local _,time=wait(0)
  685. move(time)
  686. end
  687. end,o27)
  688. end))
  689. o28.Name = "climb"
  690. o28.Parent = o27
  691. o29.Name = "ClimbAnim"
  692. o29.Parent = o28
  693. o29.AnimationId = "http://www.roblox.com/asset/?id=180436334"
  694. o30.Name = "fall"
  695. o30.Parent = o27
  696. o31.Name = "FallAnim"
  697. o31.Parent = o30
  698. o31.AnimationId = "http://www.roblox.com/asset/?id=180436148"
  699. o32.Name = "idle"
  700. o32.Parent = o27
  701. o33.Name = "Animation1"
  702. o33.Parent = o32
  703. o33.AnimationId = "http://www.roblox.com/asset/?id=180435571"
  704. o34.Name = "Weight"
  705. o34.Parent = o33
  706. o34.Value = 9
  707. o35.Name = "Animation2"
  708. o35.Parent = o32
  709. o35.AnimationId = "http://www.roblox.com/asset/?id=180435792"
  710. o36.Name = "Weight"
  711. o36.Parent = o35
  712. o36.Value = 1
  713. o37.Name = "jump"
  714. o37.Parent = o27
  715. o38.Name = "JumpAnim"
  716. o38.Parent = o37
  717. o38.AnimationId = "http://www.roblox.com/asset/?id=125750702"
  718. o39.Name = "run"
  719. o39.Parent = o27
  720. o40.Name = "RunAnim"
  721. o40.Parent = o39
  722. o40.AnimationId = "http://www.roblox.com/asset/?id=180426354"
  723. o41.Name = "sit"
  724. o41.Parent = o27
  725. o42.Name = "SitAnim"
  726. o42.Parent = o41
  727. o42.AnimationId = "http://www.roblox.com/asset/?id=178130996"
  728. o43.Name = "toolnone"
  729. o43.Parent = o27
  730. o44.Name = "ToolNoneAnim"
  731. o44.Parent = o43
  732. o44.AnimationId = "http://www.roblox.com/asset/?id=182393478"
  733. o45.Name = "walk"
  734. o45.Parent = o27
  735. o46.Name = "WalkAnim"
  736. o46.Parent = o45
  737. o46.AnimationId = "http://www.roblox.com/asset/?id=180426354"
  738. o47.Name = "Follow"
  739. o47.Parent = o1
  740. table.insert(cors,coroutine.create(function()
  741. wait()
  742. runDummyScript(function()
  743. local larm = script.Parent:FindFirstChild("Left Arm")
  744. local rarm = script.Parent:FindFirstChild("Right Arm")
  745.  
  746. function findNearestTorso(pos)
  747. local list = game.Workspace:children()
  748. local torso = nil
  749. local dist = 1000
  750. local temp = nil
  751. local human = nil
  752. local temp2 = nil
  753. for x = 1, #list do
  754. temp2 = list[x]
  755. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  756. temp = temp2:findFirstChild("Torso")
  757. human = temp2:findFirstChild("Humanoid")
  758. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  759. if (temp.Position - pos).magnitude < dist then
  760. torso = temp
  761. dist = (temp.Position - pos).magnitude
  762. end
  763. end
  764. end
  765. end
  766. return torso
  767. end
  768.  
  769. while true do
  770. wait(0.1)
  771. local target = findNearestTorso(script.Parent.Torso.Position)
  772. if target ~= nil then
  773. script.Parent.Humanoid:MoveTo(target.Position, target)
  774. end
  775. end
  776. end,o47)
  777. end))
  778. o48.Name = "Health"
  779. o48.Parent = o1
  780. table.insert(cors,coroutine.create(function()
  781. wait()
  782. runDummyScript(function()
  783. function waitForChild(parent, childName)
  784. while true do
  785. local child = parent:findFirstChild(childName)
  786. if child then
  787. return child
  788. end
  789. parent.ChildAdded:wait()
  790. end
  791. end
  792.  
  793. -- declarations
  794. wait(1)
  795.  
  796. local Figure = script.Parent
  797. local Head = waitForChild(Figure, "Head")
  798. local Humanoid = waitForChild(Figure, "Humanoid")
  799. Humanoid.Health = Humanoid.MaxHealth
  800.  
  801. function YUM(p)
  802. if (Figure.Q_Locked.Value) then return end
  803. guy = p.Parent
  804. if (guy:IsA("Model")) and (guy:findFirstChild("Humanoid")) then
  805. guy:BreakJoints()
  806. wait(0.5)
  807. --guy:Remove()
  808. Humanoid.Health = Humanoid.MaxHealth
  809. end
  810. end
  811.  
  812. for i,p in pairs(Figure:children()) do
  813. if (string.find(p.Name,"Arm")) then
  814. p.Touched:connect(YUM)
  815. end
  816. end
  817.  
  818. -- regeneration
  819. while true do
  820. wait(5)
  821. local health = Humanoid.Health
  822. if health > 0 and health < Humanoid.MaxHealth then
  823. Humanoid:TakeDamage(-5)
  824. end
  825. end
  826.  
  827. end,o48)
  828. end))
  829. o49.Parent = o1
  830. table.insert(cors,coroutine.create(function()
  831. wait()
  832. runDummyScript(function()
  833. local larm = script.Parent:FindFirstChild("Left Arm")
  834. local rarm = script.Parent:FindFirstChild("Right Arm")
  835.  
  836. function findNearestTorso(pos)
  837. local list = game.Workspace:children()
  838. local torso = nil
  839. local dist = 1000
  840. local temp = nil
  841. local human = nil
  842. local temp2 = nil
  843. for x = 1, #list do
  844. temp2 = list[x]
  845. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  846. temp = temp2:findFirstChild("Torso")
  847. human = temp2:findFirstChild("Humanoid")
  848. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  849. if (temp.Position - pos).magnitude < dist then
  850. torso = temp
  851. dist = (temp.Position - pos).magnitude
  852. end
  853. end
  854. end
  855. end
  856. return torso
  857. end
  858.  
  859. function Hit(hit)
  860. local human = hit.Parent:FindFirstChild("Humanoid")
  861. if human ~= nil then
  862. human.Health = human.Health -100
  863. end
  864. end
  865.  
  866. larm.Touched:connect(Hit)
  867. rarm.Touched:connect(Hit)
  868.  
  869. while true do
  870. wait(0.1)
  871. local target = findNearestTorso(script.Parent.Torso.Position)
  872. if target ~= nil then
  873. script.Parent.Zombie:MoveTo(target.Position, target)
  874. end
  875. end
  876.  
  877. end,o49)
  878. end))
  879. mas.Parent = workspace
  880. mas:MakeJoints()
  881. local mas1 = mas:GetChildren()
  882. for i=1,#mas1 do
  883. mas1[i].Parent = script
  884. ypcall(function() mas1[i]:MakeJoints() end)
  885. end
  886. mas:Destroy()
  887. for i=1,#cors do
  888. coroutine.resume(cors[i])
  889. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement