Advertisement
RayanChehab

Untitled

Dec 28th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.20 KB | None | 0 0
  1. local/me = game.Players.RayanChehab
  2. names = {"I has caiks", "n00b", "1337", "leet", "epicsauce", "pancaiks", "TROLOLOLO"}
  3. saund = Instance.new("Sound")
  4. saund.SoundId = "rbxasset://sounds/uuhhh.wav"
  5. saund.Pitch = 1
  6. saund.Volume = 0.8
  7.  
  8. siz = 1
  9.  
  10. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  11. part.Parent = parent
  12. part.formFactor = form
  13. part.CanCollide = collide
  14. part.Transparency = tran
  15. part.Reflectance = ref
  16. part.Size = Vector3.new(x,y,z)
  17. part.BrickColor = BrickColor.new(color)
  18. part.TopSurface = 0
  19. part.BottomSurface = 0
  20. part.Anchored = anchor
  21. part.Locked = true
  22. part:BreakJoints()
  23. end
  24.  
  25. function weld(w, p, p1, a, b, c, x, y, z)
  26. w.Parent = p
  27. w.Part0 = p
  28. w.Part1 = p1
  29. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  30. end
  31.  
  32. function run(lw,rl,ll)
  33. for i = -0.2,0.2, 0.05 do
  34. wait()
  35. rl.C0 = CFrame.fromEulerAnglesXYZ(i,0,0)
  36. ll.C0 = CFrame.fromEulerAnglesXYZ(-i,0,0)
  37. end
  38. for i = 0.2,-0.2, -0.05 do
  39. wait()
  40. rl.C0 = CFrame.fromEulerAnglesXYZ(i,0,0)
  41. ll.C0 = CFrame.fromEulerAnglesXYZ(-i,0,0)
  42. end
  43. end
  44.  
  45. function slash(rw,orig)
  46. rw.C0 = orig
  47. for i=1, 3 do
  48. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.2,0,0)
  49. wait()
  50. end
  51. for i=1, 5 do
  52. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.5,0,0)
  53. wait()
  54. end
  55. wait(0.2)
  56. for i=1, 4 do
  57. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.3,0,0)
  58. wait()
  59. end
  60. rw.C0 = orig
  61. end
  62.  
  63. function side(rw,orig,wep)
  64. rw.C0 = orig
  65. for i=1, 3 do
  66. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.1,-0.5,0)
  67. wait()
  68. end
  69. for i=1, 4 do
  70. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.25,0,0)
  71. wait()
  72. end
  73. wait(0.2)
  74. for i=1, 6 do
  75. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.35,0,0)
  76. wep.C0 = wep.C0 * CFrame.fromEulerAnglesXYZ(-0.2,0,0)
  77. wait()
  78. end
  79. for i=1, 4 do
  80. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.16,0.3,0.16)
  81. wep.C0 = wep.C0 * CFrame.fromEulerAnglesXYZ(0.3,0,0)
  82. wait()
  83. end
  84. rw.C0 = orig
  85. wep.C0 = CFrame.new(0,0,0)
  86. end
  87.  
  88. function spin(rw,orig,wep,tor)
  89. rw.C0 = orig
  90. for i=1, 4 do
  91. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.1,-0.36,0)
  92. wep.C0 = wep.C0 * CFrame.fromEulerAnglesXYZ(-0.1,0,0)
  93. wait()
  94. end
  95. local bv = Instance.new("BodyVelocity",tor)
  96. bv.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  97. bv.P = 6000
  98. bv.velocity = tor.CFrame.lookVector * 13
  99. local bav = Instance.new("BodyAngularVelocity",tor)
  100. bav.P = 6000
  101. bav.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  102. bav.angularvelocity = Vector3.new(0,40,0)
  103. wait(1.4)
  104. bv:remove()
  105. bav:remove()
  106. rw.C0 = orig
  107. wep.C0 = CFrame.new(0,0,0)
  108. end
  109.  
  110. function findtorso(pos)
  111. local torso = nil
  112. local dist = 200
  113. local hum = nil
  114. for _,v in pairs(workspace:children()) do
  115. if v:IsA("Model") and v:findFirstChild("Noob") == nil then
  116. local temp = v:findFirstChild("Humanoid")
  117. local temp2 = v:findFirstChild("Torso")
  118. if temp ~= nil and temp2 ~= nil then
  119. if temp.Health > 0 then
  120. if (pos - temp2.Position).magnitude < dist then
  121. torso = temp2
  122. dist = (pos - temp2.Position).magnitude
  123. end
  124. end
  125. end
  126. end
  127. end
  128. return torso, dist
  129. end
  130.  
  131.  
  132.  
  133. function makenpc(pos)
  134. local mod = Instance.new("Model")
  135. mod.Name = names[math.random(1,#names)]
  136. local torso = Instance.new("Part")
  137. prop(torso,mod,false,0,0,2,2,1,"Bright blue",false,"Symmetric")
  138. torso.Name = "Torso"
  139.  
  140. local hed = Instance.new("Part")
  141. prop(hed,mod,false,0,0,2,1,1,"Bright yellow",false,"Symmetric")
  142. hed.Name = "Head"
  143.  
  144. local mes = Instance.new("SpecialMesh",hed)
  145. mes.MeshType = "Head"
  146. mes.Scale = Vector3.new(1.25,1.25,1.25)
  147. local faic = Instance.new("Decal",hed)
  148. faic.Face = "Front"
  149. faic.Texture = "rbxasset://textures/face.png"
  150.  
  151. local soun = saund:clone()
  152. soun.Parent = hed
  153.  
  154. local rarm = Instance.new("Part")
  155. prop(rarm,mod,false,0,0,1,2,1,"Bright yellow",false,"Symmetric")
  156. rarm.Name = "Right Arm"
  157.  
  158. local rp = Instance.new("Part")
  159. prop(rp,mod,false,1,0,1,1,1,"Bright yellow",false,"Symmetric")
  160. rp.Name = "Right Arm"
  161.  
  162. local rw = Instance.new("Weld")
  163. weld(rw,torso,rp,0,0,0,-1.2,-0.5,0)
  164.  
  165. local larm = Instance.new("Part")
  166. prop(larm,mod,false,0,0,1,2,1,"Bright yellow",false,"Symmetric")
  167. larm.Name = "Left Arm"
  168.  
  169. local rleg = Instance.new("Part")
  170. prop(rleg,mod,false,0,0,1,2,1,"Olive",false,"Symmetric")
  171. rleg.Name = "Right Leg"
  172.  
  173. local lleg = Instance.new("Part")
  174. prop(lleg,mod,false,0,0,1,2,1,"Olive",false,"Symmetric")
  175. lleg.Name = "Left Leg"
  176.  
  177. local neck = Instance.new("Weld")
  178. weld(neck,torso,hed,0,0,0,0,-1.5,0)
  179. neck.Name = "Neck"
  180.  
  181. local raw = Instance.new("Weld")
  182. weld(raw,rp,rarm,0,0,0,0,0.9,0)
  183.  
  184. local law = Instance.new("Weld")
  185. weld(law,torso,larm,0,0,0,1.5,0,0)
  186.  
  187. local rlw = Instance.new("Weld")
  188. weld(rlw,torso,rleg,0,0,0,-0.5,2,0)
  189.  
  190. local llw = Instance.new("Weld")
  191. weld(llw,torso,lleg,0,0,0,0.5,2,0)
  192.  
  193. local ob = Instance.new("ObjectValue",mod)
  194. ob.Name = "Noob"
  195.  
  196. local hum = Instance.new("Humanoid",mod)
  197. hum.MaxHealth = 120
  198. hum.Health = 120
  199. hum.Name = "Humanoid"
  200. hum.WalkSpeed = 14
  201.  
  202. local sword = Instance.new("Part")
  203. prop(sword,mod,false,0,0,1,1,4,"White",false,"Symmetric")
  204. sword.Name = "Sword"
  205.  
  206. local deb = true
  207. local att = false
  208. sword.Touched:connect(function(hit)
  209. if att then
  210. if deb then
  211. local hum = hit.Parent:findFirstChild("Humanoid")
  212. if hum ~= nil then
  213. deb = false
  214. hum.Health = hum.Health - math.random(1,5)
  215. wait(0.15)
  216. deb = true
  217. end
  218. end
  219. end
  220. end)
  221.  
  222. local sw = Instance.new("Weld")
  223. weld(sw,rarm,sword,0,math.pi,math.pi/2,0,1,1.4)
  224. local sm = Instance.new("SpecialMesh",sword)
  225. sm.MeshType = "FileMesh"
  226. sm.MeshId = "http://www.roblox.com/asset/?id=24712232"
  227. sm.TextureId = "http://www.roblox.com/asset/?id=24718993"
  228.  
  229. mod.Parent = workspace
  230. mod:MakeJoints()
  231. mod:MoveTo(pos)
  232.  
  233. local orig = CFrame.fromEulerAnglesXYZ(math.pi/2,0.2,-0.4) * CFrame.new(0,0,0)
  234. raw.C0 = orig
  235.  
  236. local backup = mod:clone()
  237.  
  238. hum.Died:connect(function()
  239. wait(4)
  240. mod:remove()
  241. wait(9)
  242. makenpc(pos)
  243. end)
  244.  
  245. hum.Running:connect(function(speed)
  246. if speed > 1 then
  247. while speed > 1 do
  248. run(law,rlw,llw)
  249. end
  250. else
  251. law.C0 = CFrame.new(0,0,0)
  252. rlw.C0 = CFrame.new(0,0,0)
  253. llw.C0 = CFrame.new(0,0,0)
  254. end
  255. end)
  256. coroutine.resume(coroutine.create(function()
  257. while true do
  258. local targ, dis = findtorso(torso.Position)
  259. if targ ~= nil then
  260. hum:MoveTo(targ.Position,targ)
  261. if dis < 13 then
  262. local lol = math.random(1,7)
  263. if lol == 1 then
  264. att = true
  265. local duh = math.random(1,3)
  266. if duh == 1 then
  267. slash(raw,orig)
  268. elseif duh == 2 then
  269. side(raw,orig,sw)
  270. elseif duh == 3 then
  271. spin(raw,orig,sw,torso)
  272. end
  273. att = false
  274. end
  275. end
  276. local xd = math.random(1,40)
  277. if xd == 1 then
  278. hum.Jump = true
  279. end
  280. local xp = math.random(1,5)
  281. if xp == 1 then
  282. soun.Pitch = math.random(70,130)/100
  283. soun:play()
  284. end
  285. end
  286. wait(0.2)
  287. end
  288. end))
  289. end
  290.  
  291.  
  292. if script.Parent.className ~= "HopperBin" then
  293. h = Instance.new("HopperBin",me.Backpack)
  294. h.Name = "Spawn"
  295. script.Parent = h
  296. end
  297.  
  298. bin = script.Parent
  299.  
  300. function sel(mouse)
  301. mouse.Button1Down:connect(function()
  302. makenpc(mouse.Hit.p)
  303. end)
  304. end
  305.  
  306. bin.Selected:connect(sel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement