Advertisement
vibrantsinger423

kac

Aug 31st, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.22 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Model0 = Instance.new("Model")
  20. Part1 = Instance.new("Part")
  21. Part2 = Instance.new("Part")
  22. Part3 = Instance.new("Part")
  23. BlockMesh4 = Instance.new("BlockMesh")
  24. Weld5 = Instance.new("Weld")
  25. Weld6 = Instance.new("Weld")
  26. Weld7 = Instance.new("Weld")
  27. Weld8 = Instance.new("Weld")
  28. Weld9 = Instance.new("Weld")
  29. Weld10 = Instance.new("Weld")
  30. Weld11 = Instance.new("Weld")
  31. Weld12 = Instance.new("Weld")
  32. Weld13 = Instance.new("Weld")
  33. Part14 = Instance.new("Part")
  34. Part15 = Instance.new("Part")
  35. Part16 = Instance.new("Part")
  36. Script17 = Instance.new("Script")
  37. Humanoid18 = Instance.new("Humanoid")
  38. IntValue19 = Instance.new("IntValue")
  39. Script20 = Instance.new("Script")
  40. Script21 = Instance.new("Script")
  41. Script22 = Instance.new("Script")
  42. Script23 = Instance.new("Script")
  43. Model0.Name = "Kactus Man"
  44. Model0.Parent = mas
  45. Part1.Name = "Right Arm"
  46. Part1.Parent = Model0
  47. Part1.CFrame = CFrame.new(18.9544754, 3.00000501, -72.0903015, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  48. Part1.Orientation = Vector3.new(0, 90, 0)
  49. Part1.Position = Vector3.new(18.9544754, 3.00000501, -72.0903015)
  50. Part1.Rotation = Vector3.new(0, 90, 0)
  51. Part1.Color = Color3.new(0.294118, 0.592157, 0.294118)
  52. Part1.Size = Vector3.new(1, 2, 1)
  53. Part1.Anchored = true
  54. Part1.BottomSurface = Enum.SurfaceType.Smooth
  55. Part1.BrickColor = BrickColor.new("Bright green")
  56. Part1.TopSurface = Enum.SurfaceType.Smooth
  57. Part1.brickColor = BrickColor.new("Bright green")
  58. Part1.FormFactor = Enum.FormFactor.Custom
  59. Part1.formFactor = Enum.FormFactor.Custom
  60. Part2.Name = "Left Arm"
  61. Part2.Parent = Model0
  62. Part2.CFrame = CFrame.new(21.9544754, 3.00000501, -72.0903015, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  63. Part2.Orientation = Vector3.new(0, 90, 0)
  64. Part2.Position = Vector3.new(21.9544754, 3.00000501, -72.0903015)
  65. Part2.Rotation = Vector3.new(0, 90, 0)
  66. Part2.Color = Color3.new(0.294118, 0.592157, 0.294118)
  67. Part2.Size = Vector3.new(1, 2, 1)
  68. Part2.Anchored = true
  69. Part2.BottomSurface = Enum.SurfaceType.Smooth
  70. Part2.BrickColor = BrickColor.new("Bright green")
  71. Part2.TopSurface = Enum.SurfaceType.Smooth
  72. Part2.brickColor = BrickColor.new("Bright green")
  73. Part2.FormFactor = Enum.FormFactor.Custom
  74. Part2.formFactor = Enum.FormFactor.Custom
  75. Part3.Name = "Head"
  76. Part3.Parent = Model0
  77. Part3.CFrame = CFrame.new(20.4544754, 4.49999714, -72.0903015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  78. Part3.Position = Vector3.new(20.4544754, 4.49999714, -72.0903015)
  79. Part3.Color = Color3.new(0.294118, 0.592157, 0.294118)
  80. Part3.Size = Vector3.new(2, 1, 1)
  81. Part3.Anchored = true
  82. Part3.BottomSurface = Enum.SurfaceType.Smooth
  83. Part3.BrickColor = BrickColor.new("Bright green")
  84. Part3.TopSurface = Enum.SurfaceType.Smooth
  85. Part3.brickColor = BrickColor.new("Bright green")
  86. Part3.FormFactor = Enum.FormFactor.Custom
  87. Part3.formFactor = Enum.FormFactor.Custom
  88. BlockMesh4.Parent = Part3
  89. BlockMesh4.Offset = Vector3.new(0, 0.0500000007, 0)
  90. BlockMesh4.Scale = Vector3.new(0.560000002, 1.10000002, 1.10000002)
  91. Weld5.Name = "HeadWeld"
  92. Weld5.Parent = Part3
  93. Weld5.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  94. Weld5.C1 = CFrame.new(0, 0.400000006, 0.25, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  95. Weld6.Name = "HeadWeld"
  96. Weld6.Parent = Part3
  97. Weld6.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  98. Weld6.C1 = CFrame.new(-1, -1, 1, 0.707106769, -0.707106769, 0, -0.707106769, -0.707106769, 0, 0, -0, -1)
  99. Weld7.Name = "HeadWeld"
  100. Weld7.Parent = Part3
  101. Weld7.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  102. Weld7.C1 = CFrame.new(1.5, -0.5, 0.699999988, 0.0163912401, 0.999865651, 0, -0.999865651, 0.0163912401, 0, 0, 0, 1)
  103. Weld8.Name = "HeadWeld"
  104. Weld8.Parent = Part3
  105. Weld8.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  106. Weld8.C1 = CFrame.new(2, -0.5, 0.699999988, 0, 1, 0, 1, 0, 0, 0, 0, -1)
  107. Weld9.Name = "HeadWeld"
  108. Weld9.Parent = Part3
  109. Weld9.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  110. Weld9.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  111. Weld10.Name = "HeadWeld"
  112. Weld10.Parent = Part3
  113. Weld10.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  114. Weld10.C1 = CFrame.new(1.5, 0.800000012, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  115. Weld11.Name = "HeadWeld"
  116. Weld11.Parent = Part3
  117. Weld11.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  118. Weld11.C1 = CFrame.new(-1.5, -0.600000024, 0.699999988, 0.0163912401, -0.999865651, 0, 0.999865651, 0.0163912401, -0, 0, 0, 1)
  119. Weld12.Name = "HeadWeld"
  120. Weld12.Parent = Part3
  121. Weld12.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  122. Weld12.C1 = CFrame.new(-1.5, 0.800000012, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  123. Weld13.Name = "HeadWeld"
  124. Weld13.Parent = Part3
  125. Weld13.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  126. Weld13.C1 = CFrame.new(0, 0.0500000007, 0.100000001, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  127. Part14.Name = "Left Leg"
  128. Part14.Parent = Model0
  129. Part14.CFrame = CFrame.new(20.9544754, 1.00000405, -72.0903015, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  130. Part14.Orientation = Vector3.new(0, 90, 0)
  131. Part14.Position = Vector3.new(20.9544754, 1.00000405, -72.0903015)
  132. Part14.Rotation = Vector3.new(0, 90, 0)
  133. Part14.Color = Color3.new(0.294118, 0.592157, 0.294118)
  134. Part14.Size = Vector3.new(1, 2, 1)
  135. Part14.Anchored = true
  136. Part14.BottomSurface = Enum.SurfaceType.Smooth
  137. Part14.BrickColor = BrickColor.new("Bright green")
  138. Part14.TopSurface = Enum.SurfaceType.Smooth
  139. Part14.brickColor = BrickColor.new("Bright green")
  140. Part14.FormFactor = Enum.FormFactor.Custom
  141. Part14.formFactor = Enum.FormFactor.Custom
  142. Part15.Name = "Right Leg"
  143. Part15.Parent = Model0
  144. Part15.CFrame = CFrame.new(19.9544754, 1.00000405, -72.0903015, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  145. Part15.Orientation = Vector3.new(0, 90, 0)
  146. Part15.Position = Vector3.new(19.9544754, 1.00000405, -72.0903015)
  147. Part15.Rotation = Vector3.new(0, 90, 0)
  148. Part15.Color = Color3.new(0.294118, 0.592157, 0.294118)
  149. Part15.Size = Vector3.new(1, 2, 1)
  150. Part15.Anchored = true
  151. Part15.BottomSurface = Enum.SurfaceType.Smooth
  152. Part15.BrickColor = BrickColor.new("Bright green")
  153. Part15.TopSurface = Enum.SurfaceType.Smooth
  154. Part15.brickColor = BrickColor.new("Bright green")
  155. Part15.FormFactor = Enum.FormFactor.Custom
  156. Part15.formFactor = Enum.FormFactor.Custom
  157. Part16.Parent = Model0
  158. Part16.CFrame = CFrame.new(20.4544754, 3.00000501, -72.0903015, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  159. Part16.Orientation = Vector3.new(0, 180, 0)
  160. Part16.Position = Vector3.new(20.4544754, 3.00000501, -72.0903015)
  161. Part16.Rotation = Vector3.new(-180, 0, -180)
  162. Part16.Color = Color3.new(0.294118, 0.592157, 0.294118)
  163. Part16.Size = Vector3.new(2, 2, 1)
  164. Part16.Anchored = true
  165. Part16.BottomSurface = Enum.SurfaceType.Smooth
  166. Part16.BrickColor = BrickColor.new("Bright green")
  167. Part16.TopSurface = Enum.SurfaceType.Smooth
  168. Part16.brickColor = BrickColor.new("Bright green")
  169. Part16.FormFactor = Enum.FormFactor.Custom
  170. Part16.formFactor = Enum.FormFactor.Custom
  171. Script17.Name = "Health"
  172. Script17.Parent = Model0
  173. table.insert(cors,sandbox(Script17,function()
  174. function waitForChild(parent, childName)
  175.  
  176. while true do
  177.  
  178. local child = parent:findFirstChild(childName)
  179.  
  180. if child then
  181.  
  182. return child
  183.  
  184. end
  185.  
  186. parent.ChildAdded:wait()
  187.  
  188. end
  189.  
  190. end
  191.  
  192.  
  193.  
  194. -- declarations
  195.  
  196.  
  197.  
  198. local Figure = script.Parent
  199.  
  200. local Head = waitForChild(Figure, "Head")
  201.  
  202. local Humanoid = waitForChild(Figure, "Humanoid")
  203.  
  204. Humanoid.Health=500
  205.  
  206. -- regeneration
  207.  
  208. --[[
  209.  
  210. while true do
  211.  
  212. local s = wait(4)
  213.  
  214. local health = Humanoid.Health
  215.  
  216. if health > 0 and health < Humanoid.MaxHealth then
  217.  
  218. health = health + 0.08 * s * Humanoid.MaxHealth
  219.  
  220. if health * 1.05 < Humanoid.MaxHealth then
  221.  
  222. Humanoid.Health = health
  223.  
  224. else
  225.  
  226. Humanoid.Health = Humanoid.MaxHealth
  227.  
  228. end
  229.  
  230. end
  231.  
  232. end
  233.  
  234. --]]
  235. end))
  236. Humanoid18.Parent = Model0
  237. Humanoid18.LeftLeg = Part14
  238. Humanoid18.RightLeg = Part15
  239. IntValue19.Name = "Mode"
  240. IntValue19.Parent = Model0
  241. Script20.Name = "Respawn"
  242. Script20.Parent = Model0
  243. table.insert(cors,sandbox(Script20,function()
  244. name="Humanoid"
  245.  
  246. robo=script.Parent:clone()
  247.  
  248. while true do
  249. wait(1)
  250. if script.Parent.Humanoid.Health<1 then
  251. robot=robo:clone()
  252. robot.Parent=script.Parent.Parent
  253. robot:makeJoints()
  254. script.Parent:remove()
  255. end
  256. end
  257.  
  258.  
  259.  
  260.  
  261. end))
  262. Script21.Name = "Robot"
  263. Script21.Parent = Model0
  264. table.insert(cors,sandbox(Script21,function()
  265. ------------------
  266. --SPAWNING--
  267. ------------------
  268.  
  269. miked=script.Parent
  270.  
  271. itlh=miked.Torso:findFirstChild("Left Hip")
  272. itlh.Part0=miked.Torso
  273. itlh.Part1=miked:findFirstChild("Left Leg")
  274. itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  275.  
  276. itrh=miked.Torso:findFirstChild("Right Hip")
  277. itrh.Part0=miked.Torso
  278. itrh.Part1=miked:findFirstChild("Right Leg")
  279. itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  280.  
  281. itls=miked.Torso:findFirstChild("Left Shoulder")
  282. itls.Part1=miked.Torso
  283. itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  284. itls.Part0=miked:findFirstChild("Left Arm")
  285.  
  286. itrs=miked.Torso:findFirstChild("Right Shoulder")
  287. itrs.Part1=miked.Torso
  288. itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  289. itrs.Part0=miked:findFirstChild("Right Arm")
  290.  
  291. miked.Head:makeJoints()
  292. ------------------
  293. ------------------
  294.  
  295.  
  296.  
  297. function waitForChild(parent, childName)
  298. while true do
  299. local child = parent:findFirstChild(childName)
  300. if child then
  301. return child
  302. end
  303. parent.ChildAdded:wait()
  304. end
  305. end
  306.  
  307. local Figure = script.Parent
  308. local Torso = waitForChild(Figure, "Torso")
  309. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  310. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  311. local RightHip = waitForChild(Torso, "Right Hip")
  312. local LeftHip = waitForChild(Torso, "Left Hip")
  313. local Neck = waitForChild(Torso, "Neck")
  314. local Humanoid = waitForChild(Figure, "Humanoid")
  315. local pose = "Standing"
  316.  
  317. local toolAnim = "None"
  318. local toolAnimTime = 0
  319.  
  320. local isSeated = false
  321.  
  322.  
  323. function onRunning(speed)
  324. if isSeated then return end
  325.  
  326. if speed>0 then
  327. pose = "Running"
  328. else
  329. pose = "Standing"
  330. end
  331. end
  332.  
  333. function onDied()
  334. pose = "Dead"
  335.  
  336. local parts = Figure:GetChildren()
  337. for i=1,#parts do
  338. if parts.className == "Part" then
  339. Debris.AddItem(parts[i], 60)
  340. end
  341. end
  342. end
  343.  
  344. function onJumping()
  345. isSeated = false
  346. pose = "Jumping"
  347. end
  348.  
  349. function onClimbing()
  350. pose = "Climbing"
  351. end
  352.  
  353. function onGettingUp()
  354. pose = "GettingUp"
  355. end
  356.  
  357. function onFreeFall()
  358. pose = "FreeFall"
  359. end
  360.  
  361. function onDancing()
  362. pose = "Dancing"
  363. end
  364.  
  365. function onFallingDown()
  366. pose = "FallingDown"
  367. end
  368.  
  369. function onSeated()
  370. isSeated = true
  371. pose = "Seated"
  372. end
  373.  
  374.  
  375.  
  376. function moveJump()
  377. RightShoulder.MaxVelocity = 0.5
  378. LeftShoulder.MaxVelocity = 0.5
  379. RightShoulder.DesiredAngle = -3.14
  380. LeftShoulder.DesiredAngle = -3.14
  381. RightHip.DesiredAngle = 0
  382. LeftHip.DesiredAngle = 0
  383. end
  384.  
  385. function moveFreeFall()
  386. RightShoulder.MaxVelocity = 0.5
  387. LeftShoulder.MaxVelocity = 0.5
  388. RightShoulder.DesiredAngle = -1
  389. LeftShoulder.DesiredAngle = -1
  390. RightHip.DesiredAngle = 0
  391. LeftHip.DesiredAngle = 0
  392. end
  393.  
  394. function moveFloat()
  395. RightShoulder.MaxVelocity = 0.5
  396. LeftShoulder.MaxVelocity = 0.5
  397. RightShoulder.DesiredAngle = -1.57
  398. LeftShoulder.DesiredAngle = 1.57
  399. RightHip.DesiredAngle = 1.57
  400. LeftHip.DesiredAngle = -1.57
  401. end
  402.  
  403. function moveBoogy()
  404. while pose=="Boogy" do
  405. wait(.5)
  406. RightShoulder.MaxVelocity = 1
  407. LeftShoulder.MaxVelocity = 1
  408. RightShoulder.DesiredAngle = -3.14
  409. LeftShoulder.DesiredAngle = 0
  410. RightHip.DesiredAngle = 1.57
  411. LeftHip.DesiredAngle = 0
  412. wait(.5)
  413. RightShoulder.MaxVelocity = 1
  414. LeftShoulder.MaxVelocity = 1
  415. RightShoulder.DesiredAngle = 0
  416. LeftShoulder.DesiredAngle = -3.14
  417. RightHip.DesiredAngle = 0
  418. LeftHip.DesiredAngle = 1.57
  419. end
  420. end
  421.  
  422. function moveZombie()
  423. RightShoulder.MaxVelocity = 0.5
  424. LeftShoulder.MaxVelocity = 0.5
  425. RightShoulder.DesiredAngle = -1.57
  426. LeftShoulder.DesiredAngle = 1.57
  427. RightHip.DesiredAngle = 0
  428. LeftHip.DesiredAngle = 0
  429. end
  430.  
  431. function movePunch()
  432. script.Parent.Torso.Anchored=true
  433. RightShoulder.MaxVelocity = 60
  434. LeftShoulder.MaxVelocity = 0.5
  435. RightShoulder.DesiredAngle = -1.57
  436. LeftShoulder.DesiredAngle = 0
  437. RightHip.DesiredAngle = 0
  438. LeftHip.DesiredAngle = 0
  439. wait(1)
  440. script.Parent.Torso.Anchored=false
  441. pose="Standing"
  442.  
  443. end
  444.  
  445. function moveKick()
  446. RightShoulder.MaxVelocity = 0.5
  447. LeftShoulder.MaxVelocity = 0.5
  448. RightShoulder.DesiredAngle = 0
  449. LeftShoulder.DesiredAngle = 0
  450. RightHip.MaxVelocity = 40
  451. RightHip.DesiredAngle = 1.57
  452. LeftHip.DesiredAngle = 0
  453. wait(1)
  454. pose="Standing"
  455.  
  456. end
  457.  
  458. function moveFly()
  459. RightShoulder.MaxVelocity = 0.5
  460. LeftShoulder.MaxVelocity = 0.5
  461. RightShoulder.DesiredAngle = 0
  462. LeftShoulder.DesiredAngle = 0
  463. RightHip.MaxVelocity = 40
  464. RightHip.DesiredAngle = 1.57
  465. LeftHip.DesiredAngle = 0
  466. wait(1)
  467. pose="Standing"
  468.  
  469. end
  470.  
  471.  
  472. function moveClimb()
  473. RightShoulder.MaxVelocity = 0.5
  474. LeftShoulder.MaxVelocity = 0.5
  475. RightShoulder.DesiredAngle = -3.14
  476. LeftShoulder.DesiredAngle = 3.14
  477. RightHip.DesiredAngle = 0
  478. LeftHip.DesiredAngle = 0
  479. end
  480.  
  481. function moveSit()
  482. RightShoulder.MaxVelocity = 0.15
  483. LeftShoulder.MaxVelocity = 0.15
  484. RightShoulder.DesiredAngle = -3.14 /2
  485. LeftShoulder.DesiredAngle = -3.14 /2
  486. RightHip.DesiredAngle = 3.14 /2
  487. LeftHip.DesiredAngle = -3.14 /2
  488. end
  489.  
  490. function getTool()
  491.  
  492. kidTable = Figure:children()
  493. if (kidTable ~= nil) then
  494. numKids = #kidTable
  495. for i=1,numKids do
  496. if (kidTable[i].className == "Tool") then return kidTable[i] end
  497. end
  498. end
  499.  
  500. return nil
  501. end
  502.  
  503. function getToolAnim(tool)
  504.  
  505. c = tool:children()
  506. for i=1,#c do
  507. if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
  508. return c[i]
  509. end
  510. end
  511. return nil
  512. end
  513.  
  514. function animateTool()
  515.  
  516. if (toolAnim == "None") then
  517. RightShoulder.DesiredAngle = -1.57
  518. return
  519. end
  520.  
  521. if (toolAnim == "Slash") then
  522. RightShoulder.MaxVelocity = 0.5
  523. RightShoulder.DesiredAngle = 0
  524. return
  525. end
  526.  
  527. if (toolAnim == "Lunge") then
  528. RightShoulder.MaxVelocity = 0.5
  529. LeftShoulder.MaxVelocity = 0.5
  530. RightHip.MaxVelocity = 0.5
  531. LeftHip.MaxVelocity = 0.5
  532. RightShoulder.DesiredAngle = -1.57
  533. LeftShoulder.DesiredAngle = 1.0
  534. RightHip.DesiredAngle = 1.57
  535. LeftHip.DesiredAngle = 1.0
  536. return
  537. end
  538. end
  539.  
  540. function move(time)
  541. local amplitude
  542. local frequency
  543.  
  544. if (pose == "Jumping") then
  545. moveJump()
  546. return
  547. end
  548.  
  549. if (pose == "Zombie") then
  550. moveZombie()
  551. return
  552. end
  553.  
  554. if (pose == "Boogy") then
  555. moveBoogy()
  556. return
  557. end
  558.  
  559. if (pose == "Float") then
  560. moveFloat()
  561. return
  562. end
  563.  
  564. if (pose == "Punch") then
  565. movePunch()
  566. return
  567. end
  568.  
  569. if (pose == "Kick") then
  570. moveKick()
  571. return
  572. end
  573.  
  574. if (pose == "Fly") then
  575. moveFly()
  576. return
  577. end
  578.  
  579. if (pose == "FreeFall") then
  580. moveFreeFall()
  581. return
  582. end
  583.  
  584. if (pose == "Climbing") then
  585. moveClimb()
  586. return
  587. end
  588.  
  589. if (pose == "Seated") then
  590. moveSit()
  591. return
  592. end
  593.  
  594. amplitude = 0.1
  595. frequency = 1
  596.  
  597. RightShoulder.MaxVelocity = 0.15
  598. LeftShoulder.MaxVelocity = 0.15
  599. if (pose == "Running") then
  600. amplitude = 1
  601. frequency = 9
  602. elseif (pose == "Dancing") then
  603. amplitude = 2
  604. frequency = 16
  605. end
  606.  
  607.  
  608. desiredAngle = amplitude * math.sin(time*frequency)
  609. if pose~="Dancing" then
  610. RightShoulder.DesiredAngle = -desiredAngle
  611. LeftShoulder.DesiredAngle = desiredAngle
  612. RightHip.DesiredAngle = -desiredAngle
  613. LeftHip.DesiredAngle = -desiredAngle
  614. else
  615. RightShoulder.DesiredAngle = -desiredAngle
  616. LeftShoulder.DesiredAngle = desiredAngle
  617. RightHip.DesiredAngle = -desiredAngle
  618. LeftHip.DesiredAngle = -desiredAngle
  619. end
  620.  
  621.  
  622.  
  623. local tool = getTool()
  624.  
  625. if tool ~= nil then
  626.  
  627. animStringValueObject = getToolAnim(tool)
  628.  
  629. if animStringValueObject ~= nil then
  630. toolAnim = animStringValueObject.Value
  631. -- message recieved, delete StringValue
  632. animStringValueObject.Parent = nil
  633. toolAnimTime = time + .3
  634. end
  635.  
  636. if time > toolAnimTime then
  637. toolAnimTime = 0
  638. toolAnim = "None"
  639. end
  640.  
  641. animateTool()
  642.  
  643.  
  644. else
  645. toolAnim = "None"
  646. toolAnimTime = 0
  647. end
  648. end
  649.  
  650.  
  651. -- connect events
  652. -----------------------------------------------------------------------------------------------------------------------
  653.  
  654. function unequip()
  655. local items=script.Parent:children()
  656. for i=1, #items do
  657. if items[i].className=="Tool" then items[i]:remove() end
  658. end
  659. end
  660.  
  661.  
  662.  
  663.  
  664. -----------------------------------------------------------------------------------------------------------------------
  665. -----------------------------------------------------------------------------------------------------------------------
  666. -----------------------------------------------------------------------------------------------------------------------
  667. -----------------------------------------------------------------------------------------------------------------------
  668. -----------------------------------------------------------------------------------------------------------------------
  669. -----------------------------------------------------------------------------------------------------------------------
  670. -----------------------------------------------------------------------------------------------------------------------
  671. -----------------------------------------------------------------------------------------------------------------------
  672. -----------------------------------------------------------------------------------------------------------------------
  673. -----------------------------------------------------------------------------------------------------------------------
  674. -----------------------------------------------------------------------------------------------------------------------
  675. -----------------------------------------------------------------------------------------------------------------------
  676. dist=20
  677.  
  678. function followany()
  679. following=true
  680. while following==true do
  681.  
  682. local ch=game.Players:children()
  683. for i=1, #ch do
  684. local l=game.Workspace:findFirstChild(ch[i].Name)
  685. if l~=nil then
  686. local s=l.Torso
  687. local p=l.Torso.Position
  688. local q=script.Parent.Torso.Position
  689. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  690. if smallest==nil then
  691. smallest=d
  692. target=s
  693. elseif d<smallest then
  694. smallest=d
  695. target=s
  696. end
  697. end
  698. end
  699.  
  700. if smallest==nil then stopmoving() return end
  701.  
  702. if smallest>6*dist then return end
  703.  
  704. script.Parent.Humanoid:MoveTo(target.Position, target)
  705.  
  706. wait(0.5)
  707. for i=1, 6 do
  708. if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
  709. end
  710. end
  711. end
  712.  
  713.  
  714.  
  715. function gohome()
  716. script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
  717. end
  718.  
  719. function stopmoving()
  720. script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
  721. end
  722.  
  723. function follow(name)
  724. following=true
  725.  
  726. local p=game.Workspace:findFirstChild(name)
  727. if p==nil then return end
  728. while following==true do
  729. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  730. wait(0.5)
  731. for i=1, 3 do
  732. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  733. wait(0.5)
  734. end
  735. end
  736. end
  737.  
  738.  
  739. -----------------------------------------------------------------------------------------------------------------------
  740. -----------------------------------------------------------------------------------------------------------------------
  741. -----------------------------------------------------------------------------------------------------------------------
  742. -----------------------------------------------------------------------------------------------------------------------
  743. -----------------------------------------------------------------------------------------------------------------------
  744. -----------------------------------------------------------------------------------------------------------------------
  745. -----------------------------------------------------------------------------------------------------------------------
  746. -----------------------------------------------------------------------------------------------------------------------
  747. -----------------------------------------------------------------------------------------------------------------------
  748. -----------------------------------------------------------------------------------------------------------------------
  749. -----------------------------------------------------------------------------------------------------------------------
  750. -----------------------------------------------------------------------------------------------------------------------
  751.  
  752.  
  753. Humanoid.Died:connect(onDied)
  754. Humanoid.Running:connect(onRunning)
  755. Humanoid.Jumping:connect(onJumping)
  756. Humanoid.Climbing:connect(onClimbing)
  757. Humanoid.GettingUp:connect(onGettingUp)
  758. Humanoid.FreeFalling:connect(onFreeFall)
  759. Humanoid.FallingDown:connect(onFallingDown)
  760. Humanoid.Seated:connect(onSeated)
  761.  
  762.  
  763. --[[
  764.  
  765. function newSound(id)
  766. local sound = Instance.new("Sound")
  767. sound.SoundId = id
  768. sound.Parent = script.Parent.Head
  769. return sound
  770. end
  771.  
  772.  
  773. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  774. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  775. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  776. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  777. local sJumping = newSound("rbxasset://sounds/button.wav")
  778. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  779. sRunning.Looped = true
  780.  
  781. local Figure = script.Parent
  782. local Head = waitForChild(Figure, "Head")
  783. local Humanoid = waitForChild(Figure, "Humanoid")
  784.  
  785.  
  786. function onDied()
  787. sDied:play()
  788. end
  789.  
  790. function onState(state, sound)
  791. if state then
  792. sound:play()
  793. else
  794. sound:pause()
  795. end
  796. end
  797.  
  798. function onRunning(speed)
  799. if speed>0 then
  800. sRunning:play()
  801. else
  802. sRunning:pause()
  803. end
  804. end
  805.  
  806.  
  807. Humanoid.Died:connect(onDied)
  808. Humanoid.Running:connect(onRunning)
  809. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  810. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  811. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  812. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  813. --]]
  814.  
  815. local nextTime = 0
  816. local runService = game:service("RunService");
  817.  
  818. while Figure.Parent~=nil do
  819. time = runService.Stepped:wait()
  820. if time > nextTime then
  821. move(time)
  822. nextTime = time + 0.1
  823. end
  824. end
  825.  
  826. end))
  827. Script22.Parent = Model0
  828. table.insert(cors,sandbox(Script22,function()
  829. local larm = script.Parent:FindFirstChild("Left Arm")
  830. local rarm = script.Parent:FindFirstChild("Right Arm")
  831.  
  832. function findNearestTorso(pos)
  833. local list = game.Workspace:children()
  834. local torso = nil
  835. local dist = 1000
  836. local temp = nil
  837. local human = nil
  838. local temp2 = nil
  839. for x = 1, #list do
  840. temp2 = list[x]
  841. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  842. temp = temp2:findFirstChild("Torso")
  843. human = temp2:findFirstChild("Humanoid")
  844. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  845. if (temp.Position - pos).magnitude < dist then
  846. torso = temp
  847. dist = (temp.Position - pos).magnitude
  848. end
  849. end
  850. end
  851. end
  852. return torso
  853. end
  854.  
  855.  
  856.  
  857.  
  858. while true do
  859. wait(math.random(1,5))
  860. --local target = findNearestTorso(script.Parent.Torso.Position)
  861. --if target ~= nil then
  862. -- script.Parent.Zombie:MoveTo(target.Position, target)
  863. --end
  864.  
  865. script.Parent.Humanoid:MoveTo(Vector3.new(math.random(-100,100),0,math.random(-100,100)), game.Workspace.Base)
  866.  
  867.  
  868. end
  869.  
  870. end))
  871. Script23.Name = "Sound"
  872. Script23.Parent = Model0
  873. table.insert(cors,sandbox(Script23,function()
  874. -- util
  875.  
  876. function waitForChild(parent, childName)
  877. local child = parent:findFirstChild(childName)
  878. if child then return child end
  879. while true do
  880. child = parent.ChildAdded:wait()
  881. if child.Name==childName then return child end
  882. end
  883. end
  884.  
  885. function newSound(id)
  886. local sound = Instance.new("Sound")
  887. sound.SoundId = id
  888. sound.archivable = false
  889. sound.Parent = script.Parent.Head
  890. return sound
  891. end
  892.  
  893. -- declarations
  894.  
  895. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  896. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  897. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  898. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  899. local sJumping = newSound("rbxasset://sounds/button.wav")
  900. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  901. sRunning.Looped = true
  902.  
  903. local Figure = script.Parent
  904. local Head = waitForChild(Figure, "Head")
  905. local Humanoid = waitForChild(Figure, "Humanoid")
  906.  
  907. -- functions
  908.  
  909. function onDied()
  910. sDied:Play()
  911. end
  912.  
  913. function onState(state, sound)
  914. if state then
  915. sound:Play()
  916. else
  917. sound:Pause()
  918. end
  919. end
  920.  
  921. function onRunning(speed)
  922. if speed>0 then
  923. sRunning:Play()
  924. else
  925. sRunning:Pause()
  926. end
  927. end
  928.  
  929. -- connect up
  930.  
  931. Humanoid.Died:connect(onDied)
  932. Humanoid.Running:connect(onRunning)
  933. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  934. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  935. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  936. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  937.  
  938. end))
  939. for i,v in pairs(mas:GetChildren()) do
  940. v.Parent = script
  941. pcall(function() v:MakeJoints() end)
  942. end
  943. mas:Destroy()
  944. for i,v in pairs(cors) do
  945. spawn(function()
  946. pcall(v)
  947. end)
  948. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement