Advertisement
soubrhomi

smakdgfjksdbg,jsgvkj

Nov 13th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.20 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. SpecialMesh2 = Instance.new("SpecialMesh")
  22. Decal3 = Instance.new("Decal")
  23. Part4 = Instance.new("Part")
  24. Motor5 = Instance.new("Motor")
  25. Snap6 = Instance.new("Snap")
  26. Motor7 = Instance.new("Motor")
  27. Motor8 = Instance.new("Motor")
  28. Motor9 = Instance.new("Motor")
  29. Part10 = Instance.new("Part")
  30. Part11 = Instance.new("Part")
  31. Humanoid12 = Instance.new("Humanoid")
  32. IntValue13 = Instance.new("IntValue")
  33. Part14 = Instance.new("Part")
  34. Part15 = Instance.new("Part")
  35. Script16 = Instance.new("Script")
  36. BodyColors17 = Instance.new("BodyColors")
  37. Pants18 = Instance.new("Pants")
  38. Shirt19 = Instance.new("Shirt")
  39. Script20 = Instance.new("Script")
  40. Script21 = Instance.new("Script")
  41. Humanoid22 = Instance.new("Humanoid")
  42. Script23 = Instance.new("Script")
  43. Script24 = Instance.new("Script")
  44. LocalScript25 = Instance.new("LocalScript")
  45. CharacterMesh26 = Instance.new("CharacterMesh")
  46. CharacterMesh27 = Instance.new("CharacterMesh")
  47. CharacterMesh28 = Instance.new("CharacterMesh")
  48. CharacterMesh29 = Instance.new("CharacterMesh")
  49. CharacterMesh30 = Instance.new("CharacterMesh")
  50. Model0.Name = "Security Gaurd"
  51. Model0.Parent = mas
  52. Part1.Name = "Head"
  53. Part1.Parent = Model0
  54. Part1.CFrame = CFrame.new(32.5132179, 4.79862118, 2.34860468, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
  55. Part1.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
  56. Part1.Position = Vector3.new(32.5132179, 4.79862118, 2.34860468)
  57. Part1.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
  58. Part1.Color = Color3.new(0.917647, 0.721569, 0.572549)
  59. Part1.Size = Vector3.new(2, 1, 1)
  60. Part1.BrickColor = BrickColor.new("Light orange")
  61. Part1.CanCollide = false
  62. Part1.TopSurface = Enum.SurfaceType.Smooth
  63. Part1.brickColor = BrickColor.new("Light orange")
  64. Part1.FormFactor = Enum.FormFactor.Symmetric
  65. Part1.formFactor = Enum.FormFactor.Symmetric
  66. SpecialMesh2.Parent = Part1
  67. SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
  68. Decal3.Parent = Part1
  69. Decal3.Texture = "http://www.roblox.com/asset/?id=12117740"
  70. Part4.Name = "Torso"
  71. Part4.Parent = Model0
  72. Part4.CFrame = CFrame.new(32.5131073, 3.29862165, 2.34924531, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
  73. Part4.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
  74. Part4.Position = Vector3.new(32.5131073, 3.29862165, 2.34924531)
  75. Part4.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
  76. Part4.Color = Color3.new(0.917647, 0.721569, 0.572549)
  77. Part4.Size = Vector3.new(2, 2, 1)
  78. Part4.BrickColor = BrickColor.new("Light orange")
  79. Part4.CanCollide = false
  80. Part4.LeftParamA = 0
  81. Part4.LeftParamB = 0
  82. Part4.RightParamA = 0
  83. Part4.RightParamB = 0
  84. Part4.brickColor = BrickColor.new("Light orange")
  85. Part4.FormFactor = Enum.FormFactor.Symmetric
  86. Part4.formFactor = Enum.FormFactor.Symmetric
  87. Motor5.Name = "Left Hip"
  88. Motor5.Parent = Part4
  89. Motor5.MaxVelocity = 0.10000000149012
  90. Motor5.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  91. Motor5.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  92. Motor5.Part0 = Part4
  93. Motor5.Part1 = Part10
  94. Motor5.part1 = Part10
  95. Motor5.DesiredAngle = 0.075219303369522
  96. Snap6.Name = "Neck"
  97. Snap6.Parent = Part4
  98. Snap6.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  99. Snap6.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  100. Motor7.Name = "Right Hip"
  101. Motor7.Parent = Part4
  102. Motor7.MaxVelocity = 0.10000000149012
  103. Motor7.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  104. Motor7.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  105. Motor7.Part0 = Part4
  106. Motor7.Part1 = Part11
  107. Motor7.part1 = Part11
  108. Motor7.DesiredAngle = 0.075219303369522
  109. Motor8.Name = "Right Shoulder"
  110. Motor8.Parent = Part4
  111. Motor8.MaxVelocity = 0.15000000596046
  112. Motor8.C0 = CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  113. Motor8.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  114. Motor8.Part0 = Part14
  115. Motor8.Part1 = Part4
  116. Motor8.part1 = Part4
  117. Motor8.DesiredAngle = 0.075219303369522
  118. Motor9.Name = "Left Shoulder"
  119. Motor9.Parent = Part4
  120. Motor9.MaxVelocity = 0.15000000596046
  121. Motor9.C0 = CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  122. Motor9.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  123. Motor9.Part0 = Part15
  124. Motor9.Part1 = Part4
  125. Motor9.part1 = Part4
  126. Motor9.DesiredAngle = -0.075219303369522
  127. Part10.Name = "Left Leg"
  128. Part10.Parent = Model0
  129. Part10.CFrame = CFrame.new(32.5165253, 1.29883516, 2.85008669, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
  130. Part10.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
  131. Part10.Position = Vector3.new(32.5165253, 1.29883516, 2.85008669)
  132. Part10.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
  133. Part10.Color = Color3.new(0.917647, 0.721569, 0.572549)
  134. Part10.Size = Vector3.new(1, 2, 1)
  135. Part10.BottomSurface = Enum.SurfaceType.Smooth
  136. Part10.BrickColor = BrickColor.new("Light orange")
  137. Part10.CanCollide = false
  138. Part10.brickColor = BrickColor.new("Light orange")
  139. Part10.FormFactor = Enum.FormFactor.Symmetric
  140. Part10.formFactor = Enum.FormFactor.Symmetric
  141. Part11.Name = "Right Leg"
  142. Part11.Parent = Model0
  143. Part11.CFrame = CFrame.new(32.509388, 1.29840851, 1.85011244, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
  144. Part11.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
  145. Part11.Position = Vector3.new(32.509388, 1.29840851, 1.85011244)
  146. Part11.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
  147. Part11.Color = Color3.new(0.917647, 0.721569, 0.572549)
  148. Part11.Size = Vector3.new(1, 2, 1)
  149. Part11.BottomSurface = Enum.SurfaceType.Smooth
  150. Part11.BrickColor = BrickColor.new("Light orange")
  151. Part11.CanCollide = false
  152. Part11.brickColor = BrickColor.new("Light orange")
  153. Part11.FormFactor = Enum.FormFactor.Symmetric
  154. Part11.formFactor = Enum.FormFactor.Symmetric
  155. Humanoid12.Name = "Zombie"
  156. Humanoid12.Parent = Model0
  157. Humanoid12.LeftLeg = Part10
  158. Humanoid12.RightLeg = Part11
  159. Humanoid12.Torso = Part4
  160. Humanoid12.WalkSpeed = 30
  161. IntValue13.Name = "Mode"
  162. IntValue13.Parent = Model0
  163. Part14.Name = "Right Arm"
  164. Part14.Parent = Model0
  165. Part14.CFrame = CFrame.new(32.5024033, 3.29798174, 0.849283695, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
  166. Part14.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
  167. Part14.Position = Vector3.new(32.5024033, 3.29798174, 0.849283695)
  168. Part14.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
  169. Part14.Color = Color3.new(0.917647, 0.721569, 0.572549)
  170. Part14.Size = Vector3.new(1, 2, 1)
  171. Part14.BrickColor = BrickColor.new("Light orange")
  172. Part14.CanCollide = false
  173. Part14.TopSurface = Enum.SurfaceType.Smooth
  174. Part14.brickColor = BrickColor.new("Light orange")
  175. Part14.FormFactor = Enum.FormFactor.Symmetric
  176. Part14.formFactor = Enum.FormFactor.Symmetric
  177. Part15.Name = "Left Arm"
  178. Part15.Parent = Model0
  179. Part15.CFrame = CFrame.new(32.5238113, 3.29926157, 3.84920692, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
  180. Part15.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
  181. Part15.Position = Vector3.new(32.5238113, 3.29926157, 3.84920692)
  182. Part15.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
  183. Part15.Color = Color3.new(0.917647, 0.721569, 0.572549)
  184. Part15.Size = Vector3.new(1, 2, 1)
  185. Part15.BrickColor = BrickColor.new("Light orange")
  186. Part15.CanCollide = false
  187. Part15.TopSurface = Enum.SurfaceType.Smooth
  188. Part15.brickColor = BrickColor.new("Light orange")
  189. Part15.FormFactor = Enum.FormFactor.Symmetric
  190. Part15.formFactor = Enum.FormFactor.Symmetric
  191. Script16.Name = "Robot"
  192. Script16.Parent = Model0
  193. table.insert(cors,sandbox(Script16,function()
  194. model = script.Parent
  195. backup = model:Clone()
  196. regentime = 1 --5 minutes
  197.  
  198. ------------------
  199. --SPAWNING--
  200. ------------------
  201.  
  202. miked=script.Parent
  203.  
  204. itlh=miked.Torso:findFirstChild("Left Hip")
  205. itlh.Part0=miked.Torso
  206. itlh.Part1=miked:findFirstChild("Left Leg")
  207. itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  208.  
  209. itrh=miked.Torso:findFirstChild("Right Hip")
  210. itrh.Part0=miked.Torso
  211. itrh.Part1=miked:findFirstChild("Right Leg")
  212. itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  213.  
  214. itls=miked.Torso:findFirstChild("Left Shoulder")
  215. itls.Part1=miked.Torso
  216. itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  217. itls.Part0=miked:findFirstChild("Left Arm")
  218.  
  219. itrs=miked.Torso:findFirstChild("Right Shoulder")
  220. itrs.Part1=miked.Torso
  221. itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  222. itrs.Part0=miked:findFirstChild("Right Arm")
  223.  
  224. miked.Head:makeJoints()
  225. ------------------
  226. ------------------
  227.  
  228.  
  229. function waitForChild(parent, childName)
  230. while true do
  231. local child = parent:findFirstChild(childName)
  232. if child then
  233. return child
  234. end
  235. parent.ChildAdded:wait()
  236. end
  237. end
  238.  
  239. local Figure = script.Parent
  240. local Torso = waitForChild(Figure, "Torso")
  241. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  242. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  243. local RightHip = waitForChild(Torso, "Right Hip")
  244. local LeftHip = waitForChild(Torso, "Left Hip")
  245. local Neck = waitForChild(Torso, "Neck")
  246. local Humanoid = waitForChild(Figure, "Zombie")
  247. local pose = "Standing"
  248.  
  249. local toolAnim = "None"
  250. local toolAnimTime = 0
  251.  
  252. local isSeated = false
  253.  
  254.  
  255. function onRunning(speed)
  256. if isSeated then return end
  257.  
  258. if speed>0 then
  259. pose = "Running"
  260. else
  261. pose = "Standing"
  262. end
  263. end
  264.  
  265. function onDied()
  266. pose = "Dead"
  267. wait(regentime)
  268. wait(1)
  269. model:remove()
  270. model = backup:Clone()
  271. wait(3)
  272. model.Parent = game.Workspace
  273. model:MakeJoints()
  274. end
  275.  
  276. function onJumping()
  277. isSeated = false
  278. pose = "Jumping"
  279. end
  280.  
  281. function onClimbing()
  282. pose = "Climbing"
  283. end
  284.  
  285. function onGettingUp()
  286. pose = "GettingUp"
  287. end
  288.  
  289. function onFreeFall()
  290. pose = "FreeFall"
  291. end
  292.  
  293. function onDancing()
  294. pose = "Dancing"
  295. end
  296.  
  297. function onFallingDown()
  298. pose = "FallingDown"
  299. end
  300.  
  301. function onSeated()
  302. isSeated = true
  303. pose = "Seated"
  304. end
  305.  
  306.  
  307.  
  308. function moveJump()
  309. RightShoulder.MaxVelocity = 0.5
  310. LeftShoulder.MaxVelocity = 0.5
  311. RightShoulder.DesiredAngle = -3.14
  312. LeftShoulder.DesiredAngle = -3.14
  313. RightHip.DesiredAngle = 0
  314. LeftHip.DesiredAngle = 0
  315. end
  316.  
  317. function moveFreeFall()
  318. RightShoulder.MaxVelocity = 0.5
  319. LeftShoulder.MaxVelocity = 0.5
  320. RightShoulder.DesiredAngle = -1
  321. LeftShoulder.DesiredAngle = -1
  322. RightHip.DesiredAngle = 0
  323. LeftHip.DesiredAngle = 0
  324. end
  325.  
  326. function moveFloat()
  327. RightShoulder.MaxVelocity = 0.5
  328. LeftShoulder.MaxVelocity = 0.5
  329. RightShoulder.DesiredAngle = -1.57
  330. LeftShoulder.DesiredAngle = 1.57
  331. RightHip.DesiredAngle = 1.57
  332. LeftHip.DesiredAngle = -1.57
  333. end
  334.  
  335. function moveBoogy()
  336. while pose=="Boogy" do
  337. wait(.5)
  338. RightShoulder.MaxVelocity = 1
  339. LeftShoulder.MaxVelocity = 1
  340. RightShoulder.DesiredAngle = -3.14
  341. LeftShoulder.DesiredAngle = 0
  342. RightHip.DesiredAngle = 1.57
  343. LeftHip.DesiredAngle = 0
  344. wait(.5)
  345. RightShoulder.MaxVelocity = 1
  346. LeftShoulder.MaxVelocity = 1
  347. RightShoulder.DesiredAngle = 0
  348. LeftShoulder.DesiredAngle = -3.14
  349. RightHip.DesiredAngle = 0
  350. LeftHip.DesiredAngle = 1.57
  351. end
  352. end
  353.  
  354. function moveZombie()
  355. RightShoulder.MaxVelocity = 0.5
  356. LeftShoulder.MaxVelocity = 0.5
  357. RightShoulder.DesiredAngle = -1.57
  358. LeftShoulder.DesiredAngle = 1.57
  359. RightHip.DesiredAngle = 0
  360. LeftHip.DesiredAngle = 0
  361. end
  362.  
  363. function movePunch()
  364. script.Parent.Torso.Anchored=true
  365. RightShoulder.MaxVelocity = 60
  366. LeftShoulder.MaxVelocity = 0.5
  367. RightShoulder.DesiredAngle = -1.57
  368. LeftShoulder.DesiredAngle = 0
  369. RightHip.DesiredAngle = 0
  370. LeftHip.DesiredAngle = 0
  371. wait(1)
  372. script.Parent.Torso.Anchored=false
  373. pose="Standing"
  374.  
  375. end
  376.  
  377. function moveKick()
  378. RightShoulder.MaxVelocity = 0.5
  379. LeftShoulder.MaxVelocity = 0.5
  380. RightShoulder.DesiredAngle = 0
  381. LeftShoulder.DesiredAngle = 0
  382. RightHip.MaxVelocity = 40
  383. RightHip.DesiredAngle = 1.57
  384. LeftHip.DesiredAngle = 0
  385. wait(1)
  386. pose="Standing"
  387.  
  388. end
  389.  
  390. function moveFly()
  391. RightShoulder.MaxVelocity = 0.5
  392. LeftShoulder.MaxVelocity = 0.5
  393. RightShoulder.DesiredAngle = 0
  394. LeftShoulder.DesiredAngle = 0
  395. RightHip.MaxVelocity = 40
  396. RightHip.DesiredAngle = 1.57
  397. LeftHip.DesiredAngle = 0
  398. wait(1)
  399. pose="Standing"
  400.  
  401. end
  402.  
  403.  
  404. function moveClimb()
  405. RightShoulder.MaxVelocity = 0.5
  406. LeftShoulder.MaxVelocity = 0.5
  407. RightShoulder.DesiredAngle = -3.14
  408. LeftShoulder.DesiredAngle = 3.14
  409. RightHip.DesiredAngle = 0
  410. LeftHip.DesiredAngle = 0
  411. end
  412.  
  413. function moveSit()
  414. RightShoulder.MaxVelocity = 0.15
  415. LeftShoulder.MaxVelocity = 0.15
  416. RightShoulder.DesiredAngle = -3.14 /2
  417. LeftShoulder.DesiredAngle = -3.14 /2
  418. RightHip.DesiredAngle = 3.14 /2
  419. LeftHip.DesiredAngle = -3.14 /2
  420. end
  421.  
  422. function getTool()
  423.  
  424. kidTable = Figure:children()
  425. if (kidTable ~= nil) then
  426. numKids = #kidTable
  427. for i=1,numKids do
  428. if (kidTable[i].className == "Tool") then return kidTable[i] end
  429. end
  430. end
  431.  
  432. return nil
  433. end
  434.  
  435. function getToolAnim(tool)
  436.  
  437. c = tool:children()
  438. for i=1,#c do
  439. if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
  440. return c[i]
  441. end
  442. end
  443. return nil
  444. end
  445.  
  446. function animateTool()
  447.  
  448. if (toolAnim == "None") then
  449. RightShoulder.DesiredAngle = -1.57
  450. return
  451. end
  452.  
  453. if (toolAnim == "Slash") then
  454. RightShoulder.MaxVelocity = 0.5
  455. RightShoulder.DesiredAngle = 0
  456. return
  457. end
  458.  
  459. if (toolAnim == "Lunge") then
  460. RightShoulder.MaxVelocity = 0.5
  461. LeftShoulder.MaxVelocity = 0.5
  462. RightHip.MaxVelocity = 0.5
  463. LeftHip.MaxVelocity = 0.5
  464. RightShoulder.DesiredAngle = -1.57
  465. LeftShoulder.DesiredAngle = 1.0
  466. RightHip.DesiredAngle = 1.57
  467. LeftHip.DesiredAngle = 1.0
  468. return
  469. end
  470. end
  471.  
  472. function move(time)
  473. local amplitude
  474. local frequency
  475.  
  476. if (pose == "Jumping") then
  477. moveJump()
  478. return
  479. end
  480.  
  481. if (pose == "Zombie") then
  482. moveZombie()
  483. return
  484. end
  485.  
  486. if (pose == "Boogy") then
  487. moveBoogy()
  488. return
  489. end
  490.  
  491. if (pose == "Float") then
  492. moveFloat()
  493. return
  494. end
  495.  
  496. if (pose == "Punch") then
  497. movePunch()
  498. return
  499. end
  500.  
  501. if (pose == "Kick") then
  502. moveKick()
  503. return
  504. end
  505.  
  506. if (pose == "Fly") then
  507. moveFly()
  508. return
  509. end
  510.  
  511. if (pose == "FreeFall") then
  512. moveFreeFall()
  513. return
  514. end
  515.  
  516. if (pose == "Climbing") then
  517. moveClimb()
  518. return
  519. end
  520.  
  521. if (pose == "Seated") then
  522. moveSit()
  523. return
  524. end
  525.  
  526. amplitude = 0.1
  527. frequency = 1
  528.  
  529. RightShoulder.MaxVelocity = 0.15
  530. LeftShoulder.MaxVelocity = 0.15
  531. if (pose == "Running") then
  532. amplitude = 1
  533. frequency = 9
  534. elseif (pose == "Dancing") then
  535. amplitude = 2
  536. frequency = 16
  537. end
  538.  
  539.  
  540. desiredAngle = amplitude * math.sin(time*frequency)
  541. if pose~="Dancing" then
  542. RightShoulder.DesiredAngle = -desiredAngle
  543. LeftShoulder.DesiredAngle = desiredAngle
  544. RightHip.DesiredAngle = -desiredAngle
  545. LeftHip.DesiredAngle = -desiredAngle
  546. else
  547. RightShoulder.DesiredAngle = desiredAngle
  548. LeftShoulder.DesiredAngle = desiredAngle
  549. RightHip.DesiredAngle = -desiredAngle
  550. LeftHip.DesiredAngle = -desiredAngle
  551. end
  552.  
  553.  
  554.  
  555. local tool = getTool()
  556.  
  557. if tool ~= nil then
  558.  
  559. animStringValueObject = getToolAnim(tool)
  560.  
  561. if animStringValueObject ~= nil then
  562. toolAnim = animStringValueObject.Value
  563. -- message recieved, delete StringValue
  564. animStringValueObject.Parent = nil
  565. toolAnimTime = time + .3
  566. end
  567.  
  568. if time > toolAnimTime then
  569. toolAnimTime = 0
  570. toolAnim = "None"
  571. end
  572.  
  573. animateTool()
  574.  
  575.  
  576. else
  577. toolAnim = "None"
  578. toolAnimTime = 0
  579. end
  580. end
  581.  
  582.  
  583. -- connect events
  584. -----------------------------------------------------------------------------------------------------------------------
  585.  
  586. function unequip()
  587. local items=script.Parent:children()
  588. for i=1, #items do
  589. if items[i].className=="Tool" then items[i]:remove() end
  590. end
  591. end
  592.  
  593. function onChatted(msg, recipient)
  594. msg = string.lower(msg)
  595.  
  596. if string.match(msg, string.lower(script.Parent.Name))~=nil or string.match(msg, "everyone") then
  597. if string.match(msg, "equip") then
  598. if game.Workspace:findFirstChild("Hub") then
  599. if string.match(msg, "rocket") then unequip()
  600. game.Workspace.Hub.Rocket:clone().Parent=script.Parent
  601. elseif string.match(msg, "slingshot") then unequip()
  602. game.Workspace.Hub.Slingshot:clone().Parent=script.Parent
  603. elseif string.match(msg, "sword") then unequip()
  604. game.Workspace.Hub.Sword:clone().Parent=script.Parent
  605. elseif string.match(msg, "pbg") then unequip()
  606. game.Workspace.Hub.PBG:clone().Parent=script.Parent
  607. elseif string.match(msg, "superball") then unequip()
  608. game.Workspace.Hub.Superball:clone().Parent=script.Parent
  609. elseif string.match(msg, "trowel") then unequip()
  610. game.Workspace.Hub.Trowel:clone().Parent=script.Parent
  611. elseif string.match(msg, "bomb") then unequip()
  612. game.Workspace.Hub.Bomb:clone().Parent=script.Parent
  613. end
  614. end
  615. end
  616. if string.match(msg, "unequip") then unequip() end
  617. if string.match(msg, "run") then onRunning(1) end
  618. if string.match(msg, "climb") then onClimbing() end
  619. if string.match(msg, "jump") then onJumping() end
  620. if string.match(msg, "zombie") then pose="Zombie" end
  621. if string.match(msg, "disco") then pose="Boogy" end
  622. if string.match(msg, "float") then pose="Float" end
  623. if string.match(msg, "punch") then pose="Punch" end
  624. if string.match(msg, "kick") then pose="Kick" end
  625. if string.match(msg, "fly") then pose="Fly" end
  626. if string.match(msg, "heal") then script.Parent.Humanoid.Health=script.Parent.Humanoid.MaxHealth end
  627. if string.match(msg, "defend") then defence() end
  628. if string.match(msg, "stop") then pose="Standing"; proxkill=false; following=false; stopmoving() end
  629. if string.match(msg, "go home") then following=false; gohome() end
  630. if string.match(msg, "follow") then
  631. if string.match(msg, "all") then
  632. followany()
  633. else
  634. local egg=game.Players:children()
  635. for i=1, #egg do
  636. if string.match(msg, string.lower(egg[i].Name)) then
  637. follow(egg[i].Name)
  638. return
  639. end
  640. end
  641. end
  642. end
  643. if string.match(msg, "kill") then
  644. if string.match(msg, "all") then
  645. attackany()
  646. else
  647. local egg=game.Players:children()
  648. for i=1, #egg do
  649. if string.match(msg, string.lower(egg[i].Name)) then
  650. attack(egg[i].Name)
  651. return
  652. end
  653. end
  654. end
  655. end
  656.  
  657. end
  658. end
  659.  
  660. if game.Players.NumPlayers>1 then
  661. x=game.Players:children()
  662.  
  663. for i=1, #x do
  664. if script.Parent:findFirstChild("Commander")~=nil then
  665. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  666. local ch=script.Parent.Commander:children()
  667. for i=1, #ch do
  668. if string.lower(ch[i].Name)==string.lower(x[i].Name) then
  669. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  670. end
  671. end
  672. elseif string.lower(script.Parent.Commander.Value)==string.lower(x[i].Name) then
  673. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  674. end
  675. else
  676. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  677. end
  678. end
  679. end
  680.  
  681.  
  682. function onPlayerEntered(Player)
  683. while Player.Name==nil do
  684. wait(2)
  685. end
  686. if script.Parent:findFirstChild("Commander")~=nil then
  687. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  688. local ch=script.Parent.Commander:children()
  689. for i=1, #ch do
  690. if string.lower(ch[i].Name)==string.lower(Player.Name) then
  691. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  692. end
  693. end
  694. elseif string.lower(script.Parent.Commander.Value)==string.lower(Player.Name) then
  695. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  696. end
  697. else
  698. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  699. end
  700. end
  701.  
  702. game.Players.ChildAdded:connect(onPlayerEntered)
  703.  
  704.  
  705.  
  706. -----------------------------------------------------------------------------------------------------------------------
  707. -----------------------------------------------------------------------------------------------------------------------
  708. -----------------------------------------------------------------------------------------------------------------------
  709. -----------------------------------------------------------------------------------------------------------------------
  710. -----------------------------------------------------------------------------------------------------------------------
  711. -----------------------------------------------------------------------------------------------------------------------
  712. -----------------------------------------------------------------------------------------------------------------------
  713. -----------------------------------------------------------------------------------------------------------------------
  714. -----------------------------------------------------------------------------------------------------------------------
  715. -----------------------------------------------------------------------------------------------------------------------
  716. -----------------------------------------------------------------------------------------------------------------------
  717. -----------------------------------------------------------------------------------------------------------------------
  718. dist=20
  719.  
  720. function followany()
  721. following=true
  722. while following==true do
  723.  
  724. local ch=game.Players:children()
  725. for i=1, #ch do
  726. local l=game.Workspace:findFirstChild(ch[i].Name)
  727. if l~=nil then
  728. local s=l.Torso
  729. local p=l.Torso.Position
  730. local q=script.Parent.Torso.Position
  731. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  732. if smallest==nil then
  733. smallest=d
  734. target=s
  735. elseif d<smallest then
  736. smallest=d
  737. target=s
  738. end
  739. end
  740. end
  741.  
  742. if smallest==nil then stopmoving() return end
  743.  
  744. if smallest>6*dist then return end
  745.  
  746. script.Parent.Humanoid:MoveTo(target.Position, target)
  747.  
  748. wait(0.5)
  749. for i=1, 6 do
  750. if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
  751. end
  752. end
  753. end
  754.  
  755.  
  756.  
  757. function gohome()
  758. script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
  759. end
  760. function stopmoving()
  761. script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
  762. end
  763.  
  764. function follow(name)
  765. following=true
  766.  
  767. local p=game.Workspace:findFirstChild(name)
  768. if p==nil then return end
  769. while following==true do
  770. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  771. wait(0.5)
  772. for i=1, 3 do
  773. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  774. wait(0.5)
  775. end
  776. end
  777. end
  778.  
  779. function attack(name)
  780. if script.Parent:findFirstChild("Sword")~=nil then
  781. following=true
  782. local p=game.Workspace:findFirstChild(name)
  783. if p==nil then return end
  784. while following==true do
  785. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  786. wait(0.5)
  787. for i=1, 3 do
  788. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  789. local l=p.Torso.Position
  790. local q=script.Parent.Torso.Position
  791. local d=math.sqrt( ((l.x-q.x)^2)+((l.y-q.y)^2)+((l.z-q.z)^2) )
  792. if d<10 then
  793. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso); slash()
  794. if (q.y-l.y)>3 and (q.y-l.y)<7 then
  795. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  796. end
  797. end
  798. wait(1)
  799. end
  800. end
  801. end
  802. end
  803.  
  804. function attackany()
  805. if script.Parent:findFirstChild("Sword")~=nil then
  806.  
  807. following=true
  808. while following==true do
  809.  
  810. local ch=game.Players:children()
  811. for i=1, #ch do
  812. local l=game.Workspace:findFirstChild(ch[i].Name)
  813. if l~=nil then
  814. local s=l.Torso
  815. local p=l.Torso.Position
  816. local q=script.Parent.Torso.Position
  817. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  818. if smallest==nil then
  819. smallest=d
  820. target=s
  821. elseif d<smallest then
  822. smallest=d
  823. target=s
  824. end
  825. end
  826. end
  827.  
  828. if smallest==nil then stopmoving() return end
  829.  
  830. if smallest>6*dist then return end
  831.  
  832. script.Parent.Humanoid:MoveTo(target.Position, target)
  833.  
  834. if smallest<10 then
  835. slash()
  836. end
  837. if target.Parent==nil then stopmoving() return end
  838. wait(0.5)
  839. for i=1, 3 do
  840. if target.Parent.Humanoid.Health<1 then
  841. stopmoving()
  842. else
  843. local p=target.Position
  844. local q=script.Parent.Torso.Position
  845. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  846. if d<10 then
  847. script.Parent.Humanoid:MoveTo(target.Position, target); slash()
  848. if (q.y-p.y)>3 and (q.y-p.y)<7 then
  849. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  850. end
  851. end
  852. wait(1)
  853. end
  854. end
  855. end
  856. end
  857. end
  858.  
  859.  
  860. function patrol()
  861. if points==nil then
  862. points=0
  863. if game.Workspace:findFirstChild("pp1")~=nil then
  864. pp1=game.Workspace:findFirstChild("pp1")
  865. local points=points+1
  866. if game.Workspace:findFirstChild("pp2")~=nil then
  867. pp2=game.Workspace:findFirstChild("pp2")
  868. local points=points+1
  869. if game.Workspace:findFirstChild("pp3")~=nil then
  870. pp3=game.Workspace:findFirstChild("pp3")
  871. local points=points+1
  872. if game.Workspace:findFirstChild("pp4")~=nil then
  873. pp4=game.Workspace:findFirstChild("pp4")
  874. local points=points+1
  875. if game.Workspace:findFirstChild("pp5")~=nil then
  876. pp5=game.Workspace:findFirstChild("pp5")
  877. local points=points+1
  878. if game.Workspace:findFirstChild("pp6")~=nil then
  879. pp6=game.Workspace:findFirstChild("pp6")
  880. local points=points+1
  881. if game.Workspace:findFirstChild("pp7")~=nil then
  882. pp7=game.Workspace:findFirstChild("pp7")
  883. local points=points+1
  884. if game.Workspace:findFirstChild("pp8")~=nil then
  885. pp8=game.Workspace:findFirstChild("pp8")
  886. local points=points+1
  887. if game.Workspace:findFirstChild("pp9")~=nil then
  888. pp9=game.Workspace:findFirstChild("pp9")
  889. local points=points+1
  890. end
  891. end
  892. end
  893. end
  894. end
  895. end
  896. end
  897. end
  898. end
  899. end
  900.  
  901. if points<1 then return end
  902. patrolling=true
  903. local time=2
  904. if points==1 then return end
  905. if points>1 then
  906. while patrolling==true do
  907. script.Parent.Humanoid:MoveTo(pp1.Position, pp1)
  908. wait(time)
  909. script.Parent.Humanoid:MoveTo(pp2.Position, pp2)
  910. wait(time)
  911. if points>2 then
  912. script.Parent.Humanoid:MoveTo(pp3.Position, pp3)
  913. wait(time)
  914. if points>3 then
  915. script.Parent.Humanoid:MoveTo(pp4.Position, pp4)
  916. wait(time)
  917. if points>4 then
  918. script.Parent.Humanoid:MoveTo(pp5.Position, pp5)
  919. wait(time)
  920. if points>5 then
  921. script.Parent.Humanoid:MoveTo(pp6.Position, pp6)
  922. wait(time)
  923. if points>6 then
  924. script.Parent.Humanoid:MoveTo(pp7.Position, pp7)
  925. wait(time)
  926. if points>7 then
  927. script.Parent.Humanoid:MoveTo(pp8.Position, pp8)
  928. wait(time)
  929. if points>8 then
  930. script.Parent.Humanoid:MoveTo(pp9.Position, pp9)
  931. wait(time)
  932. end
  933. end
  934. end
  935. end
  936. end
  937. end
  938. end
  939. end
  940. end
  941. end
  942.  
  943.  
  944. function goto(pos,part)
  945. while true do
  946. end
  947. end
  948.  
  949.  
  950. function slash()
  951. for i=1, 3 do
  952. wait(.3)
  953. RightShoulder.MaxVelocity = 2
  954. LeftShoulder.MaxVelocity = 1
  955. RightShoulder.DesiredAngle = -2.14
  956. LeftShoulder.DesiredAngle = 0
  957. RightHip.DesiredAngle = 0
  958. LeftHip.DesiredAngle = 0
  959. wait(.2)
  960. RightShoulder.MaxVelocity = 2
  961. LeftShoulder.MaxVelocity = 1
  962. RightShoulder.DesiredAngle = 0
  963. LeftShoulder.DesiredAngle = 0
  964. RightHip.DesiredAngle = 0
  965. LeftHip.DesiredAngle = 0
  966. end
  967. end
  968.  
  969. function defence()
  970. proxkill=true
  971. while proxkill==true do
  972. local ch=game.Players:children()
  973. for i=1, #ch do
  974. local p=game.Workspace:findFirstChild(ch[i].Name)
  975. if p~=nil then
  976. local p=p.Torso.Position
  977. local q=script.Parent.Torso.Position
  978. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  979. if d<dist and d>8 then
  980. local ex=Instance.new("Explosion")
  981. ex.Position=p
  982. ex.Parent=game.Workspace
  983. end
  984. end
  985. end
  986. wait(1)
  987. end
  988. end
  989.  
  990.  
  991.  
  992.  
  993. -----------------------------------------------------------------------------------------------------------------------
  994. -----------------------------------------------------------------------------------------------------------------------
  995. -----------------------------------------------------------------------------------------------------------------------
  996. -----------------------------------------------------------------------------------------------------------------------
  997. -----------------------------------------------------------------------------------------------------------------------
  998. -----------------------------------------------------------------------------------------------------------------------
  999. -----------------------------------------------------------------------------------------------------------------------
  1000. -----------------------------------------------------------------------------------------------------------------------
  1001. -----------------------------------------------------------------------------------------------------------------------
  1002. -----------------------------------------------------------------------------------------------------------------------
  1003. -----------------------------------------------------------------------------------------------------------------------
  1004. -----------------------------------------------------------------------------------------------------------------------
  1005.  
  1006.  
  1007. Humanoid.Died:connect(onDied)
  1008. Humanoid.Running:connect(onRunning)
  1009. Humanoid.Jumping:connect(onJumping)
  1010. Humanoid.Climbing:connect(onClimbing)
  1011. Humanoid.GettingUp:connect(onGettingUp)
  1012. Humanoid.FreeFalling:connect(onFreeFall)
  1013. Humanoid.FallingDown:connect(onFallingDown)
  1014. Humanoid.Seated:connect(onSeated)
  1015.  
  1016.  
  1017. --[[
  1018.  
  1019. function newSound(id)
  1020. local sound = Instance.new("Sound")
  1021. sound.SoundId = id
  1022. sound.Parent = script.Parent.Head
  1023. return sound
  1024. end
  1025.  
  1026.  
  1027. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  1028. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  1029. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  1030. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  1031. local sJumping = newSound("rbxasset://sounds/button.wav")
  1032. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  1033. sRunning.Looped = true
  1034.  
  1035. local Figure = script.Parent
  1036. local Head = waitForChild(Figure, "Head")
  1037. local Humanoid = waitForChild(Figure, "Humanoid")
  1038.  
  1039.  
  1040. function onDied()
  1041. sDied:play()
  1042. end
  1043.  
  1044. function onState(state, sound)
  1045. if state then
  1046. sound:play()
  1047. else
  1048. sound:pause()
  1049. end
  1050. end
  1051.  
  1052. function onRunning(speed)
  1053. if speed>0 then
  1054. sRunning:play()
  1055. else
  1056. sRunning:pause()
  1057. end
  1058. end
  1059.  
  1060.  
  1061. Humanoid.Died:connect(onDied)
  1062. Humanoid.Running:connect(onRunning)
  1063. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  1064. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  1065. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  1066. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  1067. --]]
  1068.  
  1069. local nextTime = 0
  1070. local runService = game:service("RunService");
  1071.  
  1072. while Figure.Parent~=nil do
  1073. time = runService.Stepped:wait()
  1074. if time > nextTime then
  1075. move(time)
  1076. nextTime = time + 0.1
  1077. end
  1078. end
  1079.  
  1080. end))
  1081. BodyColors17.Parent = Model0
  1082. BodyColors17.HeadColor = BrickColor.new("Light orange")
  1083. BodyColors17.HeadColor3 = Color3.new(0.917647, 0.721569, 0.572549)
  1084. BodyColors17.LeftArmColor = BrickColor.new("Light orange")
  1085. BodyColors17.LeftArmColor3 = Color3.new(0.917647, 0.721569, 0.572549)
  1086. BodyColors17.LeftLegColor = BrickColor.new("Light orange")
  1087. BodyColors17.LeftLegColor3 = Color3.new(0.917647, 0.721569, 0.572549)
  1088. BodyColors17.RightArmColor = BrickColor.new("Light orange")
  1089. BodyColors17.RightArmColor3 = Color3.new(0.917647, 0.721569, 0.572549)
  1090. BodyColors17.RightLegColor = BrickColor.new("Light orange")
  1091. BodyColors17.RightLegColor3 = Color3.new(0.917647, 0.721569, 0.572549)
  1092. BodyColors17.TorsoColor = BrickColor.new("Light orange")
  1093. BodyColors17.TorsoColor3 = Color3.new(0.917647, 0.721569, 0.572549)
  1094. Pants18.Name = "Pants"
  1095. Pants18.Parent = Model0
  1096. Pants18.PantsTemplate = "http://www.roblox.com/asset/?id=37234899"
  1097. Shirt19.Name = "Shirt"
  1098. Shirt19.Parent = Model0
  1099. Shirt19.ShirtTemplate = "http://www.roblox.com/asset/?id=29703292"
  1100. Script20.Name = "Health"
  1101. Script20.Parent = Model0
  1102. table.insert(cors,sandbox(Script20,function()
  1103. function waitForChild(parent, childName)
  1104. local child = parent:findFirstChild(childName)
  1105. if child then return child end
  1106. while true do
  1107. child = parent.ChildAdded:wait()
  1108. if child.Name==childName then return child end
  1109. end
  1110. end
  1111.  
  1112. -- declarations
  1113.  
  1114. local Figure = script.Parent
  1115. local Head = waitForChild(Figure, "Head")
  1116. local Humanoid = waitForChild(Figure, "Humanoid")
  1117.  
  1118. -- regeneration
  1119. while true do
  1120. local s = wait(1)
  1121. local health = Humanoid.Health
  1122. if health > 0 and health < Humanoid.MaxHealth then
  1123. health = health + 0.01 * s * Humanoid.MaxHealth
  1124. if health * 1.05 < Humanoid.MaxHealth then
  1125. Humanoid.Health = health
  1126. else
  1127. Humanoid.Health = Humanoid.MaxHealth
  1128. end
  1129. end
  1130. end
  1131.  
  1132. end))
  1133. Script21.Name = "HealthScript v2.0"
  1134. Script21.Parent = Model0
  1135. table.insert(cors,sandbox(Script21,function()
  1136. local humanoid = script.Parent.Humanoid
  1137.  
  1138. if (humanoid == nil) then
  1139. print("ERROR: no humanoid found in 'HealthScript v2.0'")
  1140. end
  1141.  
  1142.  
  1143. function CreateGUI()
  1144. local p = game.Players:GetPlayerFromCharacter(humanoid.Parent)
  1145. print("Health for Player: " .. p.Name)
  1146. script.HealthGUI.Parent = p.PlayerGui
  1147. end
  1148.  
  1149. function UpdateGUI(health)
  1150. local pgui = game.Players:GetPlayerFromCharacter(humanoid.Parent).PlayerGui
  1151. local tray = pgui.HealthGUI.Tray
  1152.  
  1153. tray.HealthBar.Size = UDim2.new(0.2, 0, 0.8 * (health / humanoid.MaxHealth), 0)
  1154. tray.HealthBar.Position = UDim2.new(0.4, 0, 0.8 * (1- (health / humanoid.MaxHealth)) , 0)
  1155.  
  1156. end
  1157.  
  1158.  
  1159. function HealthChanged(health)
  1160. UpdateGUI(health)
  1161. end
  1162.  
  1163.  
  1164. CreateGUI()
  1165. humanoid.HealthChanged:connect(HealthChanged)
  1166. humanoid.Died:connect(function() HealthChanged(0) end)
  1167. end))
  1168. Humanoid22.Parent = Model0
  1169. Humanoid22.LeftLeg = Part10
  1170. Humanoid22.RightLeg = Part11
  1171. Humanoid22.Torso = Part4
  1172. Script23.Name = "RobloxTeam"
  1173. Script23.Parent = Model0
  1174. table.insert(cors,sandbox(Script23,function()
  1175. -- Now with exciting TeamColors HACK!
  1176.  
  1177. function waitForChild(parent, childName)
  1178. local child = parent:findFirstChild(childName)
  1179. if child then return child end
  1180. while true do
  1181. child = parent.ChildAdded:wait()
  1182. if child.Name==childName then return child end
  1183. end
  1184. end
  1185.  
  1186. -- TEAM COLORS
  1187.  
  1188.  
  1189. function onTeamChanged(player)
  1190.  
  1191. wait(1)
  1192.  
  1193. local char = player.Character
  1194. if char == nil then return end
  1195.  
  1196. if player.Neutral then
  1197. -- Replacing the current BodyColor object will force a reset
  1198. local old = char:findFirstChild("Body Colors")
  1199. if not old then return end
  1200. old:clone().Parent = char
  1201. old.Parent = nil
  1202. else
  1203. local head = char:findFirstChild("Head")
  1204. local torso = char:findFirstChild("Torso")
  1205. local left_arm = char:findFirstChild("Left Arm")
  1206. local right_arm = char:findFirstChild("Right Arm")
  1207. local left_leg = char:findFirstChild("Left Leg")
  1208. local right_leg = char:findFirstChild("Right Leg")
  1209.  
  1210. if head then head.BrickColor = BrickColor.new(24) end
  1211. if torso then torso.BrickColor = player.TeamColor end
  1212. if left_arm then left_arm.BrickColor = BrickColor.new(26) end
  1213. if right_arm then right_arm.BrickColor = BrickColor.new(26) end
  1214. if left_leg then left_leg.BrickColor = BrickColor.new(26) end
  1215. if right_leg then right_leg.BrickColor = BrickColor.new(26) end
  1216. end
  1217. end
  1218.  
  1219. function onPlayerPropChanged(property, player)
  1220. if property == "Character" then
  1221. onTeamChanged(player)
  1222. end
  1223. if property== "TeamColor" or property == "Neutral" then
  1224. onTeamChanged(player)
  1225. end
  1226. end
  1227.  
  1228.  
  1229. local cPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
  1230. cPlayer.Changed:connect(function(property) onPlayerPropChanged(property, cPlayer) end )
  1231. onTeamChanged(cPlayer)
  1232.  
  1233.  
  1234. end))
  1235. Script24.Name = "Sound"
  1236. Script24.Parent = Model0
  1237. table.insert(cors,sandbox(Script24,function()
  1238. -- util
  1239.  
  1240. function waitForChild(parent, childName)
  1241. local child = parent:findFirstChild(childName)
  1242. if child then return child end
  1243. while true do
  1244. child = parent.ChildAdded:wait()
  1245. if child.Name==childName then return child end
  1246. end
  1247. end
  1248.  
  1249. function newSound(id)
  1250. local sound = Instance.new("Sound")
  1251. sound.SoundId = id
  1252. sound.archivable = false
  1253. sound.Parent = script.Parent.Head
  1254. return sound
  1255. end
  1256.  
  1257. -- declarations
  1258.  
  1259. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  1260. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  1261. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  1262. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  1263. local sJumping = newSound("rbxasset://sounds/button.wav")
  1264. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  1265. sRunning.Looped = true
  1266.  
  1267. local Figure = script.Parent
  1268. local Head = waitForChild(Figure, "Head")
  1269. local Humanoid = waitForChild(Figure, "Humanoid")
  1270.  
  1271. -- functions
  1272.  
  1273. function onDied()
  1274. sDied:Play()
  1275. end
  1276.  
  1277. function onState(state, sound)
  1278. if state then
  1279. sound:Play()
  1280. else
  1281. sound:Pause()
  1282. end
  1283. end
  1284.  
  1285. function onRunning(speed)
  1286. if speed>0 then
  1287. sRunning:Play()
  1288. else
  1289. sRunning:Pause()
  1290. end
  1291. end
  1292.  
  1293. -- connect up
  1294.  
  1295. Humanoid.Died:connect(onDied)
  1296. Humanoid.Running:connect(onRunning)
  1297. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  1298. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  1299. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  1300. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  1301.  
  1302. end))
  1303. LocalScript25.Name = "Animate"
  1304. LocalScript25.Parent = Model0
  1305. table.insert(cors,sandbox(LocalScript25,function()
  1306. function waitForChild(parent, childName)
  1307. local child = parent:findFirstChild(childName)
  1308. if child then return child end
  1309. while true do
  1310. child = parent.ChildAdded:wait()
  1311. if child.Name==childName then return child end
  1312. end
  1313. end
  1314.  
  1315. -- ANIMATION
  1316.  
  1317. -- declarations
  1318.  
  1319. local Figure = script.Parent
  1320. local Torso = waitForChild(Figure, "Torso")
  1321. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  1322. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  1323. local RightHip = waitForChild(Torso, "Right Hip")
  1324. local LeftHip = waitForChild(Torso, "Left Hip")
  1325. local Neck = waitForChild(Torso, "Neck")
  1326. local Humanoid = waitForChild(Figure, "Humanoid")
  1327. local pose = "Standing"
  1328.  
  1329. local toolAnim = "None"
  1330. local toolAnimTime = 0
  1331.  
  1332. -- functions
  1333.  
  1334. function onRunning(speed)
  1335. if speed>0 then
  1336. pose = "Running"
  1337. else
  1338. pose = "Standing"
  1339. end
  1340. end
  1341.  
  1342. function onDied()
  1343. pose = "Dead"
  1344. end
  1345.  
  1346. function onJumping()
  1347. pose = "Jumping"
  1348. end
  1349.  
  1350. function onClimbing()
  1351. pose = "Climbing"
  1352. end
  1353.  
  1354. function onGettingUp()
  1355. pose = "GettingUp"
  1356. end
  1357.  
  1358. function onFreeFall()
  1359. pose = "FreeFall"
  1360. end
  1361.  
  1362. function onFallingDown()
  1363. pose = "FallingDown"
  1364. end
  1365.  
  1366. function onSeated()
  1367. pose = "Seated"
  1368. end
  1369.  
  1370. function onPlatformStanding()
  1371. pose = "PlatformStanding"
  1372. end
  1373.  
  1374. function moveJump()
  1375. RightShoulder.MaxVelocity = 0.5
  1376. LeftShoulder.MaxVelocity = 0.5
  1377. RightShoulder.DesiredAngle = 3.14
  1378. LeftShoulder.DesiredAngle = -3.14
  1379. RightHip.DesiredAngle = 0
  1380. LeftHip.DesiredAngle = 0
  1381. end
  1382.  
  1383.  
  1384. -- same as jump for now
  1385.  
  1386. function moveFreeFall()
  1387. RightShoulder.MaxVelocity = 0.5
  1388. LeftShoulder.MaxVelocity = 0.5
  1389. RightShoulder.DesiredAngle = 3.14
  1390. LeftShoulder.DesiredAngle = -3.14
  1391. RightHip.DesiredAngle = 0
  1392. LeftHip.DesiredAngle = 0
  1393. end
  1394.  
  1395. function moveSit()
  1396. RightShoulder.MaxVelocity = 0.15
  1397. LeftShoulder.MaxVelocity = 0.15
  1398. RightShoulder.DesiredAngle = 3.14 /2
  1399. LeftShoulder.DesiredAngle = -3.14 /2
  1400. RightHip.DesiredAngle = 3.14 /2
  1401. LeftHip.DesiredAngle = -3.14 /2
  1402. end
  1403.  
  1404. function getTool()
  1405. for _, kid in ipairs(Figure:GetChildren()) do
  1406. if kid.className == "Tool" then return kid end
  1407. end
  1408. return nil
  1409. end
  1410.  
  1411. function getToolAnim(tool)
  1412. for _, c in ipairs(tool:GetChildren()) do
  1413. if c.Name == "toolanim" and c.className == "StringValue" then
  1414. return c
  1415. end
  1416. end
  1417. return nil
  1418. end
  1419.  
  1420. function animateTool()
  1421.  
  1422. if (toolAnim == "None") then
  1423. RightShoulder.DesiredAngle = 1.57
  1424. return
  1425. end
  1426.  
  1427. if (toolAnim == "Slash") then
  1428. RightShoulder.MaxVelocity = 0.5
  1429. RightShoulder.DesiredAngle = 0
  1430. return
  1431. end
  1432.  
  1433. if (toolAnim == "Lunge") then
  1434. RightShoulder.MaxVelocity = 0.5
  1435. LeftShoulder.MaxVelocity = 0.5
  1436. RightHip.MaxVelocity = 0.5
  1437. LeftHip.MaxVelocity = 0.5
  1438. RightShoulder.DesiredAngle = 1.57
  1439. LeftShoulder.DesiredAngle = 1.0
  1440. RightHip.DesiredAngle = 1.57
  1441. LeftHip.DesiredAngle = 1.0
  1442. return
  1443. end
  1444. end
  1445.  
  1446. function move(time)
  1447. local amplitude
  1448. local frequency
  1449.  
  1450. if (pose == "Jumping") then
  1451. moveJump()
  1452. return
  1453. end
  1454.  
  1455. if (pose == "FreeFall") then
  1456. moveFreeFall()
  1457. return
  1458. end
  1459.  
  1460. if (pose == "Seated") then
  1461. moveSit()
  1462. return
  1463. end
  1464.  
  1465. local climbFudge = 0
  1466.  
  1467. if (pose == "Running") then
  1468. RightShoulder.MaxVelocity = 0.15
  1469. LeftShoulder.MaxVelocity = 0.15
  1470. amplitude = 1
  1471. frequency = 9
  1472. elseif (pose == "Climbing") then
  1473. RightShoulder.MaxVelocity = 0.5
  1474. LeftShoulder.MaxVelocity = 0.5
  1475. amplitude = 1
  1476. frequency = 9
  1477. climbFudge = 3.14
  1478. else
  1479. amplitude = 0.1
  1480. frequency = 1
  1481. end
  1482.  
  1483. desiredAngle = amplitude * math.sin(time*frequency)
  1484.  
  1485. RightShoulder.DesiredAngle = desiredAngle + climbFudge
  1486. LeftShoulder.DesiredAngle = desiredAngle - climbFudge
  1487. RightHip.DesiredAngle = -desiredAngle
  1488. LeftHip.DesiredAngle = -desiredAngle
  1489.  
  1490.  
  1491. local tool = getTool()
  1492.  
  1493. if tool then
  1494.  
  1495. animStringValueObject = getToolAnim(tool)
  1496.  
  1497. if animStringValueObject then
  1498. toolAnim = animStringValueObject.Value
  1499. -- message recieved, delete StringValue
  1500. animStringValueObject.Parent = nil
  1501. toolAnimTime = time + .3
  1502. end
  1503.  
  1504. if time > toolAnimTime then
  1505. toolAnimTime = 0
  1506. toolAnim = "None"
  1507. end
  1508.  
  1509. animateTool()
  1510.  
  1511.  
  1512. else
  1513. toolAnim = "None"
  1514. toolAnimTime = 0
  1515. end
  1516. end
  1517.  
  1518.  
  1519. -- connect events
  1520.  
  1521. Humanoid.Died:connect(onDied)
  1522. Humanoid.Running:connect(onRunning)
  1523. Humanoid.Jumping:connect(onJumping)
  1524. Humanoid.Climbing:connect(onClimbing)
  1525. Humanoid.GettingUp:connect(onGettingUp)
  1526. Humanoid.FreeFalling:connect(onFreeFall)
  1527. Humanoid.FallingDown:connect(onFallingDown)
  1528. Humanoid.Seated:connect(onSeated)
  1529. Humanoid.PlatformStanding:connect(onPlatformStanding)
  1530.  
  1531. -- main program
  1532.  
  1533. local runService = game:service("RunService");
  1534.  
  1535. while Figure.Parent~=nil do
  1536. local _, time = wait(0.1)
  1537. move(time)
  1538. end
  1539.  
  1540. end))
  1541. CharacterMesh26.Name = "Roblox 2.0 Right Leg"
  1542. CharacterMesh26.Parent = Model0
  1543. CharacterMesh26.BodyPart = Enum.BodyPart.RightLeg
  1544. CharacterMesh26.MeshId = 27111882
  1545. CharacterMesh27.Name = "Roblox 2.0 Right Arm"
  1546. CharacterMesh27.Parent = Model0
  1547. CharacterMesh27.BodyPart = Enum.BodyPart.RightArm
  1548. CharacterMesh27.MeshId = 27111864
  1549. CharacterMesh28.Name = "Roblox 2.0 Left Leg"
  1550. CharacterMesh28.Parent = Model0
  1551. CharacterMesh28.BodyPart = Enum.BodyPart.LeftLeg
  1552. CharacterMesh28.MeshId = 27111857
  1553. CharacterMesh29.Name = "Roblox 2.0 Left Arm"
  1554. CharacterMesh29.Parent = Model0
  1555. CharacterMesh29.BodyPart = Enum.BodyPart.LeftArm
  1556. CharacterMesh29.MeshId = 27111419
  1557. CharacterMesh30.Name = "Roblox 2.0 torso"
  1558. CharacterMesh30.Parent = Model0
  1559. CharacterMesh30.BodyPart = Enum.BodyPart.Torso
  1560. CharacterMesh30.MeshId = 27111894
  1561. for i,v in pairs(mas:GetChildren()) do
  1562. v.Parent = script
  1563. pcall(function() v:MakeJoints() end)
  1564. end
  1565. mas:Destroy()
  1566. for i,v in pairs(cors) do
  1567. spawn(function()
  1568. pcall(v)
  1569. end)
  1570. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement