Advertisement
DerekWeyant

Zombehs

Jul 16th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.54 KB | None | 0 0
  1. script.Parent = game.Lighting
  2. while true do
  3. wait()
  4. owner = game:GetService("Players").rigletto
  5. name="Zombie"
  6. maxhealth=math.random(200,500)
  7. walkspeed=5
  8. mindamage=1
  9. maxdamage=10
  10. distance=1000
  11. scale = 1
  12. animate = true
  13. follow = false
  14. attacking = false
  15. attacking2 = false
  16. touched1 = nil
  17. touched2 = nil
  18. meh = nil
  19. player = nil
  20. pose = "Standing"
  21. toolAnim = "None"
  22. toolAnimTime = 0
  23. climbExtra = 0
  24. Colors={BrickColor.new("New Yeller"),BrickColor.new("Really red")}
  25. attacking2 = true
  26. coroutine.resume(coroutine.create(function()
  27. while attacking2 == true do
  28. wait()
  29. meh = findNearestTorso(Character.Torso.Position)
  30. end
  31. end))
  32. w = Instance.new("Weld")
  33. dur=math.random(1,4)
  34.  
  35.  
  36.  
  37.  
  38. function move(time)
  39. if animate == false then return end
  40. local amplitude
  41. local frequency
  42. if pose == "Jumping" then
  43. RightShoulder.MaxVelocity = 0.5
  44. LeftShoulder.MaxVelocity = 0.5
  45. RightShoulder.DesiredAngle = 3.14
  46. LeftShoulder.DesiredAngle = -3.14
  47. RightHip.DesiredAngle = 0
  48. LeftHip.DesiredAngle = 0
  49. return
  50. end
  51. if pose == "FreeFall" then
  52. RightShoulder.MaxVelocity = 0.5
  53. LeftShoulder.MaxVelocity = 0.5
  54. RightShoulder.DesiredAngle = 3.14
  55. LeftShoulder.DesiredAngle = -3.14
  56. RightHip.DesiredAngle = 0
  57. LeftHip.DesiredAngle = 0
  58. return
  59. end
  60. if pose == "Seated" then
  61. RightShoulder.MaxVelocity = 0.15
  62. LeftShoulder.MaxVelocity = 0.15
  63. RightShoulder.DesiredAngle = 3.14 / 2
  64. LeftShoulder.DesiredAngle = -3.14 / 2
  65. RightHip.DesiredAngle = 3.14 / 2
  66. LeftHip.DesiredAngle = -3.14 / 2
  67. return
  68. end
  69. if pose == "Running" then
  70. RightShoulder.MaxVelocity = 0.15
  71. LeftShoulder.MaxVelocity = 0.15
  72. amplitude = 1
  73. frequency = 9
  74. elseif pose == "climbExtra" then
  75. RightShoulder.MaxVelocity = 0.5
  76. LeftShoulder.MaxVelocity = 0.5
  77. amplitude = 1
  78. frequency = 9
  79. climbExtra = 3.14
  80. else
  81. amplitude = 0.1
  82. frequency = 1
  83. end
  84. desiredAngle = amplitude * math.sin(time * frequency)
  85. RightShoulder.DesiredAngle = desiredAngle + climbExtra
  86. LeftShoulder.DesiredAngle = desiredAngle - climbExtra
  87. RightHip.DesiredAngle = -desiredAngle
  88. LeftHip.DesiredAngle = -desiredAngle
  89. for _, Children in ipairs(Character:GetChildren()) do
  90. if Children.className == "Tool" then
  91. local tool = Children
  92. end
  93. end
  94. if tool then
  95. for _, Children in ipairs(Character:GetChildren()) do
  96. if Children.Name == "toolanim" and Children.className == "StringValue" then
  97. local animStringValueObject = Children
  98. end
  99. end
  100. if animStringValueObject then
  101. toolAnim = animStringValueObject.Value
  102. animStringValueObject.Parent = nil
  103. elseif time > toolAnimTime then
  104. toolAnimTime = 0
  105. end
  106. if toolAnim == "None" then
  107. RightShoulder.DesiredAngle = 1.57
  108. elseif toolAnim == "Slash" then
  109. RightShoulder.MaxVelocity = 0.5
  110. RightShoulder.DesiredAngle = 0
  111. elseif toolAnim == "Lunge" then
  112. RightShoulder.MaxVelocity = 0.5
  113. LeftShoulder.MaxVelocity = 0.5
  114. RightHip.MaxVelocity = 0.5
  115. LeftHip.MaxVelocity = 0.5
  116. RightShoulder.DesiredAngle = 1.57
  117. LeftShoulder.DesiredAngle = 1.0
  118. RightHip.DesiredAngle = 1.57
  119. LeftHip.DesiredAngle = 1.0
  120. end
  121. else
  122. toolAnim = "None"
  123. toolAnimTime = 0
  124. end
  125. end
  126.  
  127.  
  128. Template = Instance.new("Part")
  129. Template.formFactor = "Symmetric"
  130. Template.Size = Vector3.new(scale, scale, scale)
  131. Template.BrickColor = BrickColor.new("New Yeller")
  132. Template.Locked = true
  133. leftarmcolor = Template.BrickColor
  134. rightarmcolor = Template.BrickColor
  135. leftlegcolor = Template.BrickColor
  136. rightarmcolor = Template.BrickColor
  137. torsocolor = Template.BrickColor
  138. --[[leftarmcolor = BrickColor.new(Color3.new(math.random(),math.random(),math.random()))
  139. rightarmcolor = leftarmcolor
  140. leftlegcolor = BrickColor.new(Color3.new(math.random(),math.random(),math.random()))
  141. rightlegcolor = leftlegcolor
  142. torsocolor = BrickColor.new(Color3.new(math.random(),math.random(),math.random())) ]]
  143. leftarmcolor = BrickColor.new("Brick yellow")
  144. rightarmcolor = leftarmcolor
  145. leftlegcolor = BrickColor.new("Bright green")
  146. rightlegcolor = leftlegcolor
  147. torsocolor = BrickColor.new("Reddish brown")
  148. headcolor = leftarmcolor
  149. pos = game.workspace.Base.Position+Vector3.new(math.random(-5,5),20,math.random(150,200))
  150. LeftArm = Template:Clone()
  151. LeftArm.formFactor = "Symmetric"
  152. LeftArm.Size = Vector3.new(scale, scale * 2, scale)
  153. LeftArm.Name = "Left Arm"
  154. LeftArm.BrickColor = leftarmcolor
  155. RightArm = Template:Clone()
  156. RightArm.Size = Vector3.new(scale, scale * 2, scale)
  157. RightArm.Name = "Right Arm"
  158. RightArm.BrickColor = rightarmcolor
  159. LeftLeg = Template:Clone()
  160. LeftLeg.Size = Vector3.new(scale, scale * 2, scale)
  161. LeftLeg.Name = "Left Leg"
  162. LeftLeg.BrickColor = leftlegcolor
  163. RightLeg = Template:Clone()
  164. RightLeg.Size = Vector3.new(scale, scale * 2, scale)
  165. RightLeg.Name = "Right Leg"
  166. RightLeg.BrickColor = rightlegcolor
  167. Torso = Template:Clone()
  168. Torso.Size = Vector3.new(scale * 2, scale * 2, scale)
  169. Torso.LeftSurface = "Weld"
  170. Torso.RightSurface = "Weld"
  171. Torso.Position = pos + Vector3.new(0, scale * 3.5, 0)
  172. Torso.Name = "Torso"
  173. Torso.BrickColor = torsocolor
  174. Head = Template:Clone()
  175. Head.Size = Vector3.new(scale * 2, scale, scale)
  176. Head.TopSurface = "Smooth"
  177. Head.BottomSurface = "Smooth"
  178. Head.Name = "Head"
  179. Head.BrickColor = headcolor
  180. Mesh = Instance.new("SpecialMesh")
  181. Mesh.MeshType = "Head"
  182. Mesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  183. Mesh.Parent = Head
  184. --if Character:FindFirstChild("Head") ~= nil then
  185. if owner.Character.Head:FindFirstChild("face") ~= nil then
  186. local Face = Instance.new("Decal")
  187. --Face = owner.Character.Head.face:Clone()
  188. Face.Parent = Head
  189. asset="http://www.roblox.com/asset/?id="
  190. id1="43970437"
  191. id2="46991517"
  192. id3="69387389"
  193. id4="35455927"
  194. print(dur)
  195. if dur==1 then
  196. Face.Texture = asset .. id1
  197. elseif dur==2 then
  198. Face.Texture = asset .. id2
  199. elseif dur==3 then
  200. Face.Texture = asset .. id3
  201. elseif dur==4 then
  202. Face.Texture = asset .. id4
  203. end
  204. --end
  205. Character = Instance.new("Model")
  206. Character.Name = name
  207. --script.Parent = Character
  208. Humanoid = Instance.new("Humanoid")
  209. Humanoid.WalkSpeed = walkspeed
  210. for i=0,20 do
  211. Humanoid.MaxHealth = maxhealth
  212. Humanoid.Health = maxhealth
  213. end
  214. LeftArm.Parent = Character
  215. RightArm.Parent = Character
  216. LeftLeg.Parent = Character
  217. RightLeg.Parent = Character
  218. Torso.Parent = Character
  219. Head.Parent = Character
  220. Humanoid.Parent = Character
  221. LeftShoulder = Instance.new("Motor")
  222. LeftShoulder.Parent = Torso
  223. LeftShoulder.Part0 = Torso
  224. LeftShoulder.Part1 = LeftArm
  225. LeftShoulder.MaxVelocity = 0.1
  226. LeftShoulder.C0 = CFrame.new(-Torso.Size.x / 2 - LeftArm.Size.x / 2, LeftArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  227. LeftShoulder.C1 = CFrame.new(0, LeftArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  228. LeftShoulder.Name = "Left Shoulder"
  229. RightShoulder = Instance.new("Motor")
  230. RightShoulder.Parent = Torso
  231. RightShoulder.Part0 = Torso
  232. RightShoulder.Part1 = RightArm
  233. RightShoulder.MaxVelocity = 0.1
  234. RightShoulder.C0 = CFrame.new(Torso.Size.x / 2 + RightArm.Size.x / 2, RightArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  235. RightShoulder.C1 = CFrame.new(0, RightArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  236. RightShoulder.Name = "Right Shoulder"
  237. LeftHip = Instance.new("Motor")
  238. LeftHip.Parent = Torso
  239. LeftHip.Part0 = Torso
  240. LeftHip.Part1 = LeftLeg
  241. LeftHip.MaxVelocity = 0.1
  242. LeftHip.C0 = CFrame.new(-LeftLeg.Size.x / 2, -(LeftLeg.Size.y / 4) * 3, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  243. LeftHip.C1 = CFrame.new(0, LeftLeg.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  244. LeftHip.Name = "Left Hip"
  245. RightHip = Instance.new("Motor")
  246. RightHip.Parent = Torso
  247. RightHip.Part0 = Torso
  248. RightHip.Part1 = RightLeg
  249. RightHip.MaxVelocity = 0.1
  250. RightHip.C0 = CFrame.new(RightLeg.Size.x / 2, -(RightLeg.Size.y / 4) * 3, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  251. RightHip.C1 = CFrame.new(0, RightLeg.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  252. RightHip.Name = "Right Hip"
  253. Neck = Instance.new("Weld")
  254. Neck.Name = "Neck"
  255. Neck.Part0 = Torso
  256. Neck.Part1 = Head
  257. Neck.C0 = CFrame.new(0, 1.5 * scale, 0)
  258. Neck.C1 = CFrame.new()
  259. Neck.Parent = Torso
  260. --Children = owner.Character:GetChildren()
  261. --[[for i = 1, #Children do
  262. if Children[i].className == "Shirt" or Children[i].className == "Pants" and scale == 1 then
  263. Children[i]:Clone().Parent = Character
  264. end
  265. if Children[i].className == "Hat" then
  266. if Children[i]:FindFirstChild("Handle") ~= nil then
  267. Hat = Instance.new("Hat")
  268. Children[i].Handle:Clone().Parent = Hat
  269. Hat.Handle.Size = Hat.Handle.Size * scale
  270. Hat.Handle.Mesh.Scale = Hat.Handle.Mesh.scale * scale
  271. if scale == 1 then TempScale = 1 else TempScale = scale * 1.5 end
  272. Hat.AttachmentPos = Children[i].AttachmentPos * TempScale
  273. Hat.AttachmentUp = Children[i].AttachmentUp
  274. Hat.AttachmentForward = Children[i].AttachmentForward
  275. Hat.AttachmentRight = Children[i].AttachmentRight
  276. Hat.Parent = Character
  277. end
  278. end
  279. end]]
  280. --Torso.roblox:Remove()
  281. Character.Parent = game:GetService("Workspace")
  282. --owner.Character.Sound:Clone().Parent = Character
  283. --owner.Character.Health:Clone().Parent = Character
  284. Humanoid.Died:connect(function() pose = "Dead" wait(5.5) if Character == nil then return end Character:Remove() end)
  285. Humanoid.Running:connect(function(speed) if speed > 0 then pose = "Running" else pose = "Standing" end end)
  286. Humanoid.Jumping:connect(function() pose = "Jumping" end)
  287. Humanoid.Climbing:connect(function() pose = "climbExtra" end)
  288. Humanoid.GettingUp:connect(function() pose = "GettingUp" end)
  289. Humanoid.FreeFalling:connect(function() pose = "FreeFall" end)
  290. Humanoid.FallingDown:connect(function() pose = "FallingDown" end)
  291. Humanoid.Seated:connect(function() pose = "Seated" end)
  292. Humanoid.PlatformStanding:connect(function() pose = "PlatformStanding" end)
  293. --owner.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  294.  
  295. attackdebounce=false
  296. CRIT=false
  297. Damagefunc1=function(hit,lowdamage,highdamage,Knockback)
  298. if attackdebounce == false then
  299. attackdebounce = true
  300. coroutine.resume(coroutine.create(function()
  301. wait(0.1)
  302. attackdebounce = false
  303. end))
  304. if hit.Parent==nil then
  305. return
  306. end
  307. h=hit.Parent:FindFirstChild("Humanoid")
  308. if h~=nil and hit.Parent:FindFirstChild("Torso")~=nil then
  309. Damage=Damage
  310. --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then
  311. return
  312. end]]
  313. -- print(c.Value)
  314. Damage=math.random(lowdamage,highdamage)
  315. h:TakeDamage(Damage)
  316. showDamage(hit.Parent,Damage,.5)
  317. vp=Instance.new("BodyVelocity")
  318. vp.P=500
  319. vp.maxForce=Vector3.new(math.huge,0,math.huge)
  320. -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback
  321. vp.velocity=Torso.CFrame.lookVector*Knockback+Torso.Velocity/1.05
  322. if Knockback>0 then
  323. vp.Parent=hit.Parent.Torso
  324. end
  325. game:GetService("Debris"):AddItem(vp,.25)
  326. game:GetService("Debris"):AddItem(r,.5)
  327. CRIT=false
  328. hitDeb=true
  329. AttackPos=6
  330. end
  331. end
  332. end
  333.  
  334. showDamage=function(Char,Dealt,du)
  335. m=Instance.new("Model")
  336. m.Name=tostring(Dealt)
  337. h=Instance.new("Humanoid")
  338. h.Health=0
  339. h.MaxHealth=0
  340. h.Parent=m
  341. c=Instance.new("Part")
  342. c.Transparency=0
  343. c.BrickColor=BrickColor:Red()
  344. if CRIT==true then
  345. c.BrickColor=BrickColor.new("Really red")
  346. end
  347. c.Name="Head"
  348. c.TopSurface=0
  349. c.BottomSurface=0
  350. c.formFactor="Plate"
  351. c.Size=Vector3.new(1,.4,1)
  352. ms=Instance.new("CylinderMesh")
  353. ms.Scale=Vector3.new(.8,.8,.8)
  354. if CRIT==true then
  355. ms.Scale=Vector3.new(1.25,1.5,1.25)
  356. end
  357. ms.Parent=c
  358. c.Reflectance=0
  359. Instance.new("BodyGyro").Parent=c
  360. c.Parent=m
  361. c.CFrame=CFrame.new(Char["Head"].CFrame.p+Vector3.new(0,1.5,0))
  362. f=Instance.new("BodyPosition")
  363. f.P=2000
  364. f.D=100
  365. f.maxForce=Vector3.new(math.huge,math.huge,math.huge)
  366. f.position=c.Position+Vector3.new(0,3,0)
  367. f.Parent=c
  368. game:GetService("Debris"):AddItem(m,.5+du)
  369. c.CanCollide=false
  370. m.Parent=workspace
  371. c.CanCollide=false
  372. end
  373.  
  374. coroutine.resume(coroutine.create(function()
  375. local larm = Character:FindFirstChild("Left Arm")
  376. local rarm = Character:FindFirstChild("Right Arm")
  377.  
  378. function findNearestTorso(pos)
  379. local list = game.Workspace:children()
  380. local torso = nil
  381. local dist = distance
  382. local temp = nil
  383. local human = nil
  384. local temp2 = nil
  385. for x = 1, #list do
  386. temp2 = list[x]
  387. if (temp2.className == "Model") and (temp2 ~= Character) and (temp2.Name~="Zombie") then
  388. temp = temp2:findFirstChild("Torso")
  389. human = temp2:findFirstChild("Humanoid")
  390. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  391. if (temp.Position - pos).magnitude < dist then
  392. torso = temp
  393. dist = (temp.Position - pos).magnitude
  394. end
  395. end
  396. end
  397. end
  398. return torso
  399. end
  400.  
  401. wander=false
  402. while true do
  403. wait(0.1)
  404. local target = meh
  405. if target ~= nil then
  406. Character.Humanoid:MoveTo(target.Position, target)
  407. else
  408. if wander==false then
  409. wander=true
  410. Humanoid:MoveTo(game:GetService("Workspace").Base.Position + Vector3.new(math.random(-game:GetService("Workspace").Base.Size.x, game:GetService("Workspace").Base.Size.x), math.random(-game:GetService("Workspace").Base.Size.y, game:GetService("Workspace").Base.Size.y), math.random(-game:GetService("Workspace").Base.Size.z, game:GetService("Workspace").Base.Size.z)), game:GetService("Workspace").Base)
  411. -- Humanoid:MoveTo(game:GetService("Workspace").Base.Position, game:GetService("Workspace").Base)
  412. for i=0,math.random(100,500) do
  413. if target==nil then
  414. wait()
  415. end
  416. end
  417. wander=false
  418. end
  419. end
  420. end
  421. end))
  422. coroutine.resume(coroutine.create(function()
  423. while true do
  424. wait()
  425. local target = findNearestTorso(Character.Torso.Position)
  426. if target ~= nil then
  427. if attacking2 == true then
  428. local targ = target.Position - Torso.Position
  429. local magni = targ.magnitude
  430. if magni<=10 then
  431. wait(math.random()-math.random())
  432. rand=math.random(1,2)
  433. if rand==1 then
  434. local RSH = Torso["Right Shoulder"]
  435. RSH.Parent = nil
  436. local RW = Instance.new("Weld")
  437. RW.Parent = RightArm
  438. RW.Part0 = Torso
  439. RW.Part1 = RightArm
  440. RW.C0 = CFrame.new((1.5)*scale, (0.5)*scale, 0)
  441. RW.C1 = CFrame.new(0, (0.5)*scale, 0)
  442. con1=RightArm.Touched:connect(function(hit) Damagefunc1(hit,mindamage,maxdamage,3) end)
  443. for i = 0,1,0.2 do
  444. wait()
  445. RW.C0 = CFrame.new((1.5-0.5*i)*scale,(0.5)*scale,(-0.5*i)*scale)*CFrame.fromEulerAnglesXYZ(2*i,0,-0.5*i)
  446. end
  447. for i = 0,1,0.2 do
  448. wait()
  449. RW.C0 = CFrame.new((1.5-0.5+0.5*i)*scale,(0.5)*scale,(-0.5+0.5*i)*scale)*CFrame.fromEulerAnglesXYZ(2-2*i,0,-0.5+0.5*i)
  450. end
  451. con1:disconnect()
  452. RW.Parent = nil
  453. RSH.Parent = Torso
  454. elseif rand==2 then
  455. local LSH = Torso["Left Shoulder"]
  456. LSH.Parent = nil
  457. local LW = Instance.new("Weld")
  458. LW.Parent = LeftArm
  459. LW.Part0 = Torso
  460. LW.Part1 = LeftArm
  461. LW.C0 = CFrame.new((-1.5)*scale, (0.5)*scale, 0)
  462. LW.C1 = CFrame.new(0, (0.5)*scale, 0)
  463. con1=LeftArm.Touched:connect(function(hit) Damagefunc1(hit,mindamage,maxdamage,3) end)
  464. for i = 0,1,0.2 do
  465. wait()
  466. LW.C0 = CFrame.new((-1.5+0.5*i)*scale,(0.5)*scale,(-0.5*i)*scale)*CFrame.fromEulerAnglesXYZ(2*i,0,0.5*i)
  467. end
  468. for i = 0,1,0.2 do
  469. wait()
  470. LW.C0 = CFrame.new((-1.5+0.5-0.5*i)*scale,(0.5)*scale,(-0.5+0.5*i)*scale)*CFrame.fromEulerAnglesXYZ(2-2*i,0,0.5-0.5*i)
  471. end
  472. con1:disconnect()
  473. LW.Parent = nil
  474. LSH.Parent = Torso
  475. end
  476. end
  477. end
  478. end
  479. end
  480. end))
  481. while Character.Parent ~= nil do
  482. move(game:GetService("Workspace").DistributedGameTime)
  483. if Character.Parent ~= nil then
  484. if Character.Humanoid.Sit == true then
  485. wait(math.random(0,3))
  486. Character.Humanoid.Jump = true
  487. Character.Humanoid.Sit = false
  488. end
  489. if Character.Humanoid.PlatformStand == true then
  490. wait(math.random(0,3))
  491. Character.Humanoid.PlatformStand = false
  492. end
  493. end
  494. wait(0.1)
  495. end
  496. end
  497. end
  498. -- lego mediafire
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement