Advertisement
quoc9x

Untitled

Nov 1st, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.82 KB | None | 0 0
  1. maxhealth=100
  2. walkspeed=20
  3. mindamage=2
  4. maxdamage=28
  5. distance=20
  6. CharName="YOLO"
  7. armcolor="Black"
  8. legcolor="Black"
  9. torsocolor=Color3.new(math.random(),math.random(),math.random())
  10. headcolor="Cool yellow"
  11. function Part(P, Anch, Coll, Tran, Ref, Col, X, Y, Z)
  12. local p = Instance.new("Part")
  13. p.TopSurface = 0
  14. p.BottomSurface = 0
  15. p.Transparency = Tran
  16. p.Reflectance = Ref
  17. p.CanCollide = Coll
  18. p.Anchored = Anch
  19. p.BrickColor = BrickColor.new(Col)
  20. p.formFactor = "Custom"
  21. p.Size = Vector3.new(X,Y,Z)
  22. p.Parent = P
  23. p.Locked = true
  24. p:BreakJoints()
  25. return p
  26. end
  27.  
  28. function Weld(P0, P1, X, Y, Z, A, B, C)
  29. local w = Instance.new("Weld")
  30. w.Part0 = P0
  31. w.Part1 = P1
  32. w.C1 = CN(X, Y, Z) * CA(A, B, C)
  33. w.Parent = P0
  34. return w
  35. end
  36.  
  37. CA = CFrame.Angles
  38. CN = CFrame.new
  39. V3 = Vector3.new
  40. MR = math.rad
  41. MP = math.pi
  42. MRA = math.random
  43. MH = math.huge
  44.  
  45. Asset = "http://www.roblox.com/asset/?id="
  46. Noob = nil
  47.  
  48. function MakeMotor(torso, p1, c0, c1)
  49. local mot = Instance.new("Motor6D")
  50. mot.C0 = c0
  51. mot.C1 = c1
  52. mot.Part0 = torso
  53. mot.Part1 = p1
  54. mot.Parent = torso
  55. return mot
  56. end
  57.  
  58. function Set(tab)
  59. for _,v in pairs(tab) do
  60. local motor = v[1]
  61. local vel = v[2]
  62. local des = v[3]
  63. motor.MaxVelocity = vel
  64. motor.DesiredAngle = des
  65. end
  66. end
  67.  
  68. function Animate(Hum, RSH, LSH, RH, LH)
  69. local pose = "Standing"
  70. local function sit()
  71. pose = "Seated"
  72. end
  73. local function jump()
  74. pose = "Jumping"
  75. end
  76. local function died()
  77. pose = "Dead"
  78. end
  79. local function falling()
  80. pose = "Falling"
  81. end
  82. local function climbing()
  83. pose = "Climbing"
  84. end
  85. local function run(speed)
  86. if speed > 0.5 then
  87. pose = "Running"
  88. else
  89. pose = "Standing"
  90. end
  91. end
  92. local function move(tiem)
  93. local amplitude, frequency
  94. if pose == "Seated" then
  95. Set({{RSH, 0.15, math.pi/2}, {LSH, 0.15, -math.pi/2}, {LH, 0.15, math.pi/2}, {RH, 0.15, -math.pi/2}})
  96. return
  97. end
  98. if pose == "Jumping" then
  99. Set({{RSH, 0.3, math.pi}, {LSH, 0.3, -math.pi}, {LH, 0.3, 0}, {RH, 0.3, 0}})
  100. return
  101. end
  102. if pose == "Falling" then
  103. Set({{RSH, 0.35, math.pi}, {LSH, 0.35, -math.pi}, {LH, 0.35, 0}, {RH, 0.35, 0}})
  104. return
  105. end
  106. local climb = 0
  107. if pose == "Running" then
  108. RSH.MaxVelocity = 0.15
  109. LSH.MaxVelocity = 0.15
  110. amplitude = 1
  111. frequency = 8
  112. elseif pose == "Climbing" then
  113. RSH.MaxVelocity = 0.3
  114. LSH.MaxVelocity = 0.3
  115. amplitude = 1
  116. frequency = 8
  117. climb = math.pi
  118. else
  119. amplitude = 0.1
  120. frequency = 1
  121. end
  122. des = amplitude * math.sin(tiem*frequency)
  123. RSH.DesiredAngle = des + climb
  124. LSH.DesiredAngle = des - climb
  125. RH.DesiredAngle = -des
  126. LH.DesiredAngle = -des
  127. end
  128. Hum.Jumping:connect(jump)
  129. Hum.Running:connect(run)
  130. Hum.Seated:connect(sit)
  131. Hum.Died:connect(died)
  132. Hum.FreeFalling:connect(falling)
  133. Hum.Climbing:connect(climbing)
  134. coroutine.resume(coroutine.create(function()
  135. while pose ~= "Dead" do
  136. local _, time = wait(0.1)
  137. move(time)
  138. end
  139. end))
  140. end
  141.  
  142. function MakeNoob(pos, scale)
  143. torsocolor=Color3.new(math.random(),math.random(),math.random())
  144. local Nub = Instance.new("Model")
  145. Nub.Name = CharName
  146. Noob = Nub
  147. local Torso = Part(Nub, false, false, 0, 0, torsocolor, 2*scale, 2*scale, 1*scale)
  148. Torso.Name = "Torso"
  149. local Head = Part(Nub, false, false, 0, 0, headcolor, 2*scale, 1*scale, 1*scale)
  150. Head.Name = "Head"
  151. local Neck = MakeMotor(Torso, Head, CN(0, 1*scale, 0), CN(0, -0.5*scale, 0))
  152. local HeadMesh = Instance.new("SpecialMesh",Head)
  153. HeadMesh.Scale = V3(1.25, 1.25, 1.25)
  154. local Face = Instance.new("Decal")
  155. Face.Name="face"
  156. Face.Parent = Head
  157. Face.Face="Front"
  158. asset="http://www.roblox.com/asset/?id="
  159. id1="8348827"
  160. id2="34818288"
  161. id3="33950936"
  162. id4="76309089"
  163. dur=math.random(1,4)
  164. if dur==1 then
  165. Face.Texture = asset .. id1
  166. elseif dur==2 then
  167. Face.Texture = asset .. id2
  168. elseif dur==3 then
  169. Face.Texture = asset .. id3
  170. elseif dur==4 then
  171. Face.Texture = asset .. id4
  172. end
  173. local Rarm = Part(Nub, false, false, 0, 0, armcolor, 1*scale, 2*scale, 1*scale)
  174. Rarm.Name = "Right Arm"
  175. local Larm = Part(Nub, false, false, 0, 0, armcolor, 1*scale, 2*scale, 1*scale)
  176. Larm.Name = "Left Arm"
  177. local Rleg = Part(Nub, false, false, 0, 0, legcolor, 1*scale, 2*scale, 1*scale)
  178. Rleg.Name = "Right Leg"
  179. local Lleg = Part(Nub, false, false, 0, 0, legcolor, 1*scale, 2*scale, 1*scale)
  180. Lleg.Name = "Left Leg"
  181.  
  182. attackdebounce=false
  183. CRIT=false
  184. Damagefunc1=function(hit,lowdamage,highdamage,Knockback)
  185. if attackdebounce == false then
  186. attackdebounce = true
  187. coroutine.resume(coroutine.create(function()
  188. wait(0.1)
  189. attackdebounce = false
  190. end))
  191. if hit.Parent==nil then
  192. return
  193. end
  194. h=hit.Parent:FindFirstChild("Humanoid")
  195. if h~=nil and hit.Parent:FindFirstChild("Torso")~=nil then
  196. Damage=Damage
  197. --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then
  198. return
  199. end]]
  200. -- print(c.Value)
  201. Damage=math.random(lowdamage,highdamage)
  202. h:TakeDamage(Damage)
  203. showDamage(hit.Parent,Damage,.5)
  204. vp=Instance.new("BodyVelocity")
  205. vp.P=500
  206. vp.maxForce=Vector3.new(math.huge,0,math.huge)
  207. -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback
  208. vp.velocity=Torso.CFrame.lookVector*Knockback+Torso.Velocity/1.05
  209. if Knockback>0 then
  210. vp.Parent=hit.Parent.Torso
  211. end
  212. game:GetService("Debris"):AddItem(vp,.25)
  213. CRIT=false
  214. hitDeb=true
  215. AttackPos=6
  216. end
  217. end
  218. end
  219.  
  220. showDamage=function(Char,Dealt,du)
  221. m=Instance.new("Model")
  222. m.Name=tostring(Dealt)
  223. h=Instance.new("Humanoid")
  224. h.Health=0
  225. h.MaxHealth=0
  226. h.Parent=m
  227. c=Instance.new("Part")
  228. c.Transparency=0
  229. c.BrickColor=BrickColor:Red()
  230. if CRIT==true then
  231. c.BrickColor=BrickColor.new("Really red")
  232. end
  233. c.Name="Head"
  234. c.TopSurface=0
  235. c.BottomSurface=0
  236. c.formFactor="Plate"
  237. c.Size=Vector3.new(1,.4,1)
  238. ms=Instance.new("CylinderMesh")
  239. ms.Scale=Vector3.new(.8,.8,.8)
  240. if CRIT==true then
  241. ms.Scale=Vector3.new(1.25,1.5,1.25)
  242. end
  243. ms.Parent=c
  244. c.Reflectance=0
  245. Instance.new("BodyGyro").Parent=c
  246. c.Parent=m
  247. c.CFrame=CFrame.new(Char["Head"].CFrame.p+Vector3.new(0,1.5,0))
  248. f=Instance.new("BodyPosition")
  249. f.P=2000
  250. f.D=100
  251. f.maxForce=Vector3.new(math.huge,math.huge,math.huge)
  252. f.position=c.Position+Vector3.new(0,3,0)
  253. f.Parent=c
  254. game:GetService("Debris"):AddItem(m,.5+du)
  255. c.CanCollide=false
  256. m.Parent=workspace
  257. c.CanCollide=false
  258. end
  259.  
  260. local larm = Larm
  261. local rarm = Rarm
  262.  
  263. function findNearestTorso(pos)
  264. local list = game.Workspace:children()
  265. local torso = nil
  266. local dist = distance
  267. local temp = nil
  268. local human = nil
  269. local temp2 = nil
  270. for x = 1, #list do
  271. temp2 = list[x]
  272. if (temp2.className == "Model") and (temp2 ~= Nub) and (temp2.Name~=CharName) then
  273. temp = temp2:findFirstChild("Torso")
  274. human = temp2:findFirstChild("Humanoid")
  275. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  276. if (temp.Position - pos).magnitude < dist then
  277. torso = temp
  278. dist = (temp.Position - pos).magnitude
  279. end
  280. end
  281. end
  282. end
  283. return torso
  284. end
  285.  
  286. so = function(id,par,vol,pit)
  287. coroutine.resume(coroutine.create(function()
  288. local sou = Instance.new("Sound",par or workspace)
  289. sou.Volume=vol
  290. sou.Pitch=pit or 1
  291. sou.SoundId=id
  292. wait()
  293. sou:play()
  294. wait(6)
  295. sou:Remove()
  296. end))
  297. end
  298.  
  299. local RSH = MakeMotor(Torso, Rarm, CN(1*scale, 0.5*scale, 0) * CA(0, MR(90), 0), CN(-0.5*scale, 0.5*scale, 0) * CA(0, MR(90), 0))
  300. RSH.Name="Right Shoulder"
  301. local LSH = MakeMotor(Torso, Larm, CN(-1*scale, 0.5*scale, 0) * CA(0, MR(-90), 0), CN(0.5*scale, 0.5*scale, 0) * CA(0, MR(-90), 0))
  302. LSH.Name="Left Shoulder"
  303. local RH = MakeMotor(Torso, Rleg, CN(0.5*scale, -1*scale, 0) * CA(0, MR(-90), 0), CN(0, 1*scale, 0) * CA(0, MR(-90), 0))
  304. RH.Name="Right Hip"
  305. local LH = MakeMotor(Torso, Lleg, CN(-0.5*scale, -1*scale, 0) * CA(0, MR(90), 0), CN(0, 1*scale, 0) * CA(0, MR(90), 0))
  306. LH.Name="Left Hip"
  307. local Hum = Instance.new("Humanoid")
  308. Hum.MaxHealth = maxhealth
  309. Hum.Health = Hum.MaxHealth
  310. Hum.WalkSpeed = walkspeed
  311. coroutine.resume(coroutine.create(function()
  312. for i=1,30 do
  313. wait(0)
  314. Hum.MaxHealth = maxhealth
  315. Hum.Health = maxhealth
  316. end
  317. Hum:TakeDamage(1)
  318. Hum.Health=Hum.MaxHealth
  319. end))
  320. wander=false
  321. coroutine.resume(coroutine.create(function(Humanoid)
  322. wait(1)
  323. Humanoid.Health=Humanoid.MaxHealth
  324. Humanoid:TakeDamage(1)
  325. end),Hum)
  326. Hum.Parent = Nub
  327. Nub.Parent = workspace
  328. Nub:MakeJoints()
  329. Nub:MoveTo(pos)
  330. Animate(Hum,RSH,LSH,RH,LH)
  331. coroutine.resume(coroutine.create(function(Character)
  332. local con1=nil
  333. local con2=nil
  334. while Character.Parent~=nil do
  335. wait()
  336. target = findNearestTorso(Character.Torso.Position)
  337. wander=false
  338. if target~=nil then
  339. Character.Humanoid:MoveTo(target.Position, target)
  340. local targ = target.Position - Torso.Position
  341. local magni = targ.magnitude
  342. if magni<=10 then
  343. Tors=Character.Torso
  344. RightArm=Character["Right Arm"]
  345. LeftArm=Character["Left Arm"]
  346. RightLeg=Character["Right Leg"]
  347. LeftLeg=Character["Left Leg"]
  348. if math.random(1,2)==1 then
  349. local RSH = Torso["Right Shoulder"]
  350. RSH.Parent = nil
  351. local RW = Instance.new("Weld")
  352. RW.Parent = RightArm
  353. RW.Part0 = Torso
  354. RW.Part1 = RightArm
  355. RW.C0 = CFrame.new((1.5)*scale, (0.5)*scale, 0)
  356. RW.C1 = CFrame.new(0, (0.5)*scale, 0)
  357. con1=RightArm.Touched:connect(function(hit) Damagefunc1(hit,mindamage,maxdamage,3) end)
  358. con2=RightLeg.Touched:connect(function(hit) Damagefunc1(hit,mindamage,maxdamage,3) end)
  359. so("http://roblox.com/asset/?id=10209640",Tors,0.5,math.random())
  360. for i = 0,1,0.2 do
  361. wait()
  362. 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)
  363. end
  364. for i = 0,1,0.2 do
  365. wait()
  366. 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)
  367. end
  368. con1:disconnect()
  369. con2:disconnect()
  370. wait(1)
  371. RW.Parent=nil
  372. RSH.Parent=Torso
  373. else
  374. local LSH = Torso["Left Shoulder"]
  375. LSH.Parent = nil
  376. local LW = Instance.new("Weld")
  377. LW.Parent = LeftArm
  378. LW.Part0 = Torso
  379. LW.Part1 = LeftArm
  380. LW.C0 = CFrame.new((-1.5)*scale, (0.5)*scale, 0)
  381. LW.C1 = CFrame.new(0, (0.5)*scale, 0)
  382. con1=LeftArm.Touched:connect(function(hit) Damagefunc1(hit,mindamage,maxdamage,3) end)
  383. con2=LeftLeg.Touched:connect(function(hit) Damagefunc1(hit,mindamage,maxdamage,3) end)
  384. so("http://roblox.com/asset/?id=10209640",Torso,0.5,math.random())
  385. for i = 0,1,0.2 do
  386. wait()
  387. 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)
  388. end
  389. for i = 0,1,0.2 do
  390. wait()
  391. 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)
  392. end
  393. con1:disconnect()
  394. con2:disconnect()
  395. LW.Parent = nil
  396. LSH.Parent = Torso
  397. end
  398. end
  399. else
  400. if wander==false then
  401. wander=true
  402. Character.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)
  403. -- Humanoid:MoveTo(game:GetService("Workspace").Base.Position, game:GetService("Workspace").Base)
  404. for i=0,math.random(100,500) do
  405. if target==nil then
  406. wait()
  407. end
  408. end
  409. wander=false
  410. end
  411. end
  412. end
  413. end),Nub)
  414. Hum.Died:connect(function()
  415. wait(6)
  416. Nub:remove()
  417. wait(4)
  418. torsocolor=Color3.new(math.random(),math.random(),math.random())
  419. MakeNoob(V3(MRA(-300, 300),10,MRA(-300, 300)), scale)
  420. end)
  421. return Nub
  422. end
  423. for i = 1, 10 do
  424. local nub = MakeNoob(V3(MRA(-300, 300),10,MRA(-300, 300)), 1)
  425. end
  426. -- mediafire
  427. --[[
  428. Copyrighted (C) Fenrier 2013
  429. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement