memberhero

Untitled

Jul 28th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.87 KB | None | 0 0
  1. plr=game:service'Players'.LocalPlayer
  2. ch=plr.Character
  3. ch.Humanoid.WalkSpeed=30
  4. torso=ch.Torso
  5. m=plr:GetMouse()
  6. cfn=CFrame.new
  7. mr=math.rad
  8. ang=CFrame.Angles
  9. int=Instance.new
  10.  
  11. loaded=6
  12. ammo=36
  13.  
  14. sheath=false
  15.  
  16.  
  17. if ch:findFirstChild('Scattergun') then
  18. ch.Scattergun:Destroy()
  19. end
  20.  
  21. local shoot=int("Sound",ch.Head)
  22. shoot.SoundId='http://www.roblox.com/asset?id=148358346'
  23. shoot.Volume=1
  24.  
  25. local click=int("Sound",ch.Head)
  26. click.SoundId='http://www.roblox.com/asset?id=138089340'
  27. click.Volume=1
  28. click.Pitch=1.4
  29.  
  30. local bonk=int("Sound",ch.Head)
  31. bonk.SoundId='http://www.roblox.com/asset?id=130944130'
  32. bonk.Volume=1
  33.  
  34. local hedshot=int("Sound",ch.Head)
  35. hedshot.SoundId='http://www.roblox.com/asset?id=147936251'
  36. hedshot.Volume=1
  37.  
  38. local hit=int("Sound",ch.Head)
  39. hit.SoundId='http://www.roblox.com/asset?id=131864673'
  40. hit.Volume=1
  41.  
  42. game:service'ContentProvider':Preload(shoot.SoundId)
  43. game:service'ContentProvider':Preload(click.SoundId)
  44. game:service'ContentProvider':Preload(bonk.SoundId)
  45.  
  46. local tube=Instance.new("Model",ch)
  47. tube.Name='Scattergun'
  48.  
  49. function weld(p0,p1,c0)--basic weld function
  50. local w=Instance.new("Weld",p0)
  51. w.Part0=p0
  52. w.Part1=p1
  53. w.C0=c0
  54. return w
  55. end
  56.  
  57. Weld = function(p0,p1,x,y,z,rx,ry,rz,par)--recommend to use this with my weld. use this function only with arm lockers.
  58. p0.Position = p1.Position
  59. local w = Instance.new('Motor',par or p0)
  60. w.Part0 = p1
  61. w.Part1 = p0
  62. w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
  63. w.MaxVelocity = .1
  64. return w
  65. end
  66.  
  67.  
  68. function cp(parent,color,size,anchored,cancollide)--creates a part. automagically returns the part so you can edit it manually.
  69. local newp=Instance.new("Part",parent)
  70. newp.TopSurface='Smooth'
  71. newp.BottomSurface='Smooth'
  72. newp.FormFactor="Custom"
  73. newp.BrickColor=BrickColor.new(color)
  74. newp.Size=size
  75. newp.Anchored=anchored
  76. newp.CanCollide=cancollide
  77. newp:BreakJoints()
  78. return newp
  79. end
  80.  
  81. Tween = function(Weld, Stop, Step,a)--epik tween function. simple, no lag, awesome.
  82. ypcall(function()--- TweenWeld function (not made by me)
  83. local func = function()
  84. local Start = Weld.C1
  85. local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
  86. local Stop = Stop
  87. local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
  88.  
  89. for i = 0, 1, Step or .1 do
  90. Weld.C1 = CFrame.new( (Start.p.X * (1 - i)) + (Stop.p.X * i),
  91. (Start.p.Y * (1 - i)) + (Stop.p.Y * i),
  92. (Start.p.Z * (1 - i)) + (Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
  93. (X1 * (1 - i)) + (X2 * i), (Y1 * (1 - i)) + (Y2 * i),
  94. (Z1 * (1 - i)) + (Z2 * i) )
  95. wait()
  96. end
  97.  
  98. Weld.C1 = Stop
  99. end
  100.  
  101. if a then coroutine.wrap(func)() else func() end
  102. end)
  103. end
  104.  
  105. rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
  106. rabr.Position = torso.Position
  107. rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
  108. w = Instance.new("Weld",tube)
  109. w.Part0,w.Part1 = ch['Right Arm'],rabr
  110. w.C1 = CFrame.new(0,-.5,0)
  111.  
  112. labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
  113. labr.Position = torso.Position
  114. lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
  115. ww = Instance.new("Weld",tube)
  116. ww.Part0,ww.Part1 = ch['Left Arm'],labr
  117. ww.C1 = CFrame.new(0,-.5,0)
  118.  
  119.  
  120. local shaft=cp(tube,"Brown",Vector3.new(1,1,1))
  121. shaft.Material='Wood'
  122. mw=weld(ch['Right Arm'],shaft,CFrame.new(0,-1.9,-1)*ang(mr(-45),mr(-14),0))
  123. local blk=int('BlockMesh',shaft)
  124. blk.Scale=Vector3.new(0.5,0.2,1)
  125.  
  126. local shaft2=cp(tube,"Brown",Vector3.new(1,1,1))
  127. weld(shaft,shaft2,CFrame.new(0,0,-0.65)*ang(mr(-90),0,0))
  128. shaft2.Material="Wood"
  129. local blk=int('SpecialMesh',shaft2)
  130. blk.MeshType='Wedge'
  131. blk.Scale=Vector3.new(0.5,0.3,0.2)
  132.  
  133. --[[
  134. local shaft3=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  135. weld(shaft,shaft3,CFrame.new(0,1,-0.65)*ang(mr(45),0,0)*CFrame.new(0,0,0)*ang(0,mr(30),0))
  136. local blk=int('SpecialMesh',shaft3)
  137. blk.MeshType='Wedge'
  138. blk.Scale=Vector3.new(0.5,0.2,0.2)
  139. ]]
  140.  
  141. local cyla=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  142. Instance.new("CylinderMesh",cyla).Scale=Vector3.new(0.71,0.5,0.71)
  143. cyla.Reflectance=0.2
  144. weld(shaft,cyla,CFrame.new(0,0.094,0.59)*ang(mr(90),0,0))
  145. local bh=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  146. weld(cyla,bh,CFrame.new(0,0.5,0))
  147. bh.Reflectance=0.2
  148. local blk=int('BlockMesh',bh)
  149. blk.Scale=Vector3.new(0.23,0.5,0.32)
  150. local bh2=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  151. weld(bh,bh2,CFrame.new(0,0.27,0.02)*ang(mr(16),0,0))
  152. bh2.Reflectance=0.2
  153. local blk=int('BlockMesh',bh2)
  154. blk.Scale=Vector3.new(0.23,0.2,0.32)
  155. local bh3=cp(tube,"Brown",Vector3.new(1,1,1))
  156. bh3.Material='Wood'
  157. weld(bh,bh3,CFrame.new(0,0.5,0.1)*ang(mr(20),0,0))
  158. local blk=int('BlockMesh',bh3)
  159. blk.Scale=Vector3.new(0.23,0.4,0.32)
  160. local bh4=cp(tube,"Black",Vector3.new(1,1,1))
  161. weld(bh,bh4,CFrame.new(0,-0.1,0.27)*ang(0,0,0))
  162. local blk=int('BlockMesh',bh4)
  163. blk.Scale=Vector3.new(0.1,0.1,0.2)
  164. local bh5=cp(tube,"Black",Vector3.new(1,1,1))
  165. weld(bh4,bh5,CFrame.new(0,0.06,0.06)*ang(0,0,0))
  166. local blk=int('BlockMesh',bh5)
  167. blk.Scale=Vector3.new(0.1,0.2,0.1)
  168. local bh5=cp(tube,"Black",Vector3.new(1,1,1))
  169. weld(bh4,bh5,CFrame.new(0,0.3,0)*ang(mr(-20),0,0))
  170. local blk=int('BlockMesh',bh5)
  171. blk.Scale=Vector3.new(0.1,0.4,0.1)
  172.  
  173.  
  174.  
  175.  
  176. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  177. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
  178. cyl.Reflectance=0.2
  179. weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
  180. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  181. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
  182. cyl.Reflectance=0.2
  183. weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
  184.  
  185. local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
  186. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
  187. cyl.Reflectance=0.2
  188. weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
  189. local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
  190. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
  191. cyl.Reflectance=0.2
  192. weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
  193.  
  194. local cyl1=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  195. Instance.new("BlockMesh",cyl1).Scale=Vector3.new(0.18,1.48,0.1)
  196. cyl.Reflectance=0.2
  197. weld(shaft,cyl1,CFrame.new(0,0.31,-0.37)*ang(mr(90),0,0))
  198.  
  199. local cylz=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  200. Instance.new("BlockMesh",cylz).Scale=Vector3.new(0.09,0.14,0.1)
  201. cylz.Reflectance=0.2
  202. weld(shaft,cylz,CFrame.new(0,0.37,-0.97)*ang(0,0,0))
  203.  
  204. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  205. Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
  206. cyl.Reflectance=0.2
  207. weld(shaft,cyl,CFrame.new(0.06,0.37,0.135)*ang(0,0,0))
  208. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  209. Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
  210. cyl.Reflectance=0.2
  211. weld(shaft,cyl,CFrame.new(-0.06,0.37,0.135)*ang(0,0,0))
  212.  
  213. local hn=cp(tube,"Dark stone grey",Vector3.new(0.2,0.7,0.2))
  214. hw=weld(torso,hn,CFrame.new(0.4,0.8,0.8)*ang(0,0,mr(135)))
  215. Instance.new("CylinderMesh",hn)
  216.  
  217. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  218. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  219. weld(hn,rng,CFrame.new(0,0.3,0))
  220. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  221. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  222. weld(hn,rng,CFrame.new(0,0.2,0))
  223. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  224. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  225. weld(hn,rng,CFrame.new(0,0.1,0))
  226. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  227. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  228. weld(hn,rng,CFrame.new(0,0,0))
  229. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  230. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  231. weld(hn,rng,CFrame.new(0,-0.1,0))
  232. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  233. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  234. weld(hn,rng,CFrame.new(0,-0.2,0))
  235. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  236. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  237. weld(hn,rng,CFrame.new(0,-0.3,0))
  238.  
  239. local sph=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  240. sph.Reflectance=0.5
  241. local ball=int("SpecialMesh",sph)
  242. ball.MeshType='Sphere'
  243. ball.Scale=Vector3.new(0.3,0.3,0.3)
  244. weld(hn,sph,CFrame.new(0,-0.4,0))
  245.  
  246. local sph2=cp(tube,"Really blue",Vector3.new(1,1,1))
  247. local ball=int("CylinderMesh",sph2)
  248. ball.Scale=Vector3.new(0.31,0.07,0.31)
  249. weld(sph,sph2,CFrame.new(0,0,0))
  250.  
  251. local c1=cp(tube,"Really blue",Vector3.new(1,1,1))
  252. local ball=int("CylinderMesh",c1)
  253. ball.Scale=Vector3.new(0.38,0.07,0.38)
  254. weld(hn,c1,CFrame.new(0,0.4,0))
  255.  
  256. local c2=cp(tube,"Dark stone grey",Vector3.new(1,1.9,1))
  257. c2.Reflectance=0.5
  258. local ball=int("CylinderMesh",c2)
  259. ball.Scale=Vector3.new(0.31,1,0.31)
  260. weld(c1,c2,CFrame.new(0,1,0))
  261. local c3=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  262. c3.Reflectance=0.5
  263. local ball=int("SpecialMesh",c3)
  264. ball.MeshType='Sphere'
  265. ball.Scale=Vector3.new(0.31,0.31,0.31)
  266. weld(c2,c3,CFrame.new(0,1,0))
  267.  
  268.  
  269.  
  270.  
  271.  
  272. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  273. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  274.  
  275. attacking=false
  276. hds=false
  277. createBullet=function()
  278. local radz=math.random(math.random(8,11),math.random(12,15))
  279. local asd=m.Hit.lookVector
  280. local vel=Vector3.new(math.random(2,radz),math.random(1,radz),math.random(1,radz))+asd*350
  281. print'sn'
  282. local b=cp(tube,"Black",Vector3.new(0.4,0.4,0.4))
  283. b.Name='bs'
  284. print'sn'
  285. local sp=int("SpecialMesh",b)
  286. sp.MeshType='Sphere'
  287. b.CFrame=cylz.CFrame
  288. b.Velocity=vel
  289. b.Touched:connect(function(p)
  290. if p.Name~='bs' and p.Parent~=tube then
  291. hit:Play()
  292. end
  293. if p.Name=='Head' then
  294. print'headshot'
  295. hedshot:Play()
  296. p.Parent.Humanoid:TakeDamage(14)
  297. end
  298. if p.Parent:findFirstChild("Humanoid") and p.Parent~=ch then
  299. p.Parent.Humanoid:TakeDamage(6)
  300. b:Destroy()
  301. elseif p.Parent:findFirstChild("Humanoid")==nil and p.Parent~=ch then
  302. if p.Name~='Base' and p.Name~='bs' and p:GetMass()<30 and p.Parent~=tube then
  303. p:Destroy()
  304. b:Destroy()
  305. end
  306. end
  307. end)
  308. end
  309.  
  310. loadBullet=function()
  311. Tween(lw,cfn(0,0.6,0)*ang(mr(-68),mr(60),0),0.2)
  312. click:Play()
  313. loaded=loaded+1
  314. ammo=ammo-1
  315. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.2)
  316. end
  317.  
  318. m.Button1Down:connect(function()
  319. if attacking==false and sheath==false and loaded>0 and sheath==false then
  320. loaded=loaded-1
  321. attacking=true
  322. Spawn(function()
  323. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-55),mr(30),0),0.4)
  324. end)
  325. Tween(rw,cfn(0,0,0)*ang(mr(-55),mr(-30),0),0.4)
  326. for i=1,4 do
  327. createBullet()
  328. end
  329. local shell=cp(workspace,"Really red",Vector3.new(0.2,0.2,0.4))
  330. shell.Position=cyla.Position
  331. shoot:Play()
  332. Spawn(function()
  333. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.4)
  334. end)
  335. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.4)
  336. wait(0.1)
  337. attacking=false
  338. elseif attacking==false and sheath==false and loaded<=0 and sheath==false then
  339. attacking=true
  340. Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
  341. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
  342. for i=1,6 do
  343. loadBullet()
  344. end
  345. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  346. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  347. attacking=false
  348.  
  349. elseif attacking==false and sheath==true then
  350. attacking=true
  351. Tween(rw,cfn()*ang(mr(-146),mr(-45),mr(-45)),0.2)
  352. Tween(rw,cfn()*ang(mr(-26),mr(20),mr(-45)),0.2)
  353. Tween(rw,cfn()*ang(mr(-80),mr(-30),mr(-10)),0.1)
  354. attacking=false
  355.  
  356. end
  357.  
  358.  
  359. end)
  360.  
  361. deb=false
  362.  
  363. c2.Touched:connect(function(p)
  364. if sheath==true and attacking==true and deb==false then
  365. deb=true
  366. print'bonk'
  367. if p.Parent:findFirstChild('Humanoid') then
  368. p.Parent.Humanoid:TakeDamage(30)
  369. bonk:Play()
  370. end
  371. wait(1)
  372. deb=false
  373. end
  374. end)
  375.  
  376. m.KeyDown:connect(function(k)
  377. if k=='r' and attacking==false then
  378. attacking=true
  379. Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
  380. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
  381. for i=1,6-loaded do
  382. loadBullet()
  383. end
  384. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  385. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  386. attacking=false
  387. elseif k=='q' and attacking==false and sheath==false then
  388. attacking=true
  389. Tween(lw,cfn(),0.2)
  390. Tween(rw,cfn()*ang(mr(30),mr(-30),0),0.1)
  391. mw:Destroy()
  392. mw=weld(ch.Torso,shaft,CFrame.new(0,-1,0.9)*ang(0,mr(90),0)*CFrame.new()*ang(mr(-30),0,0))
  393. Tween(rw,cfn()*ang(mr(-179),0,0),0.1)
  394. hw:Destroy()
  395. hw=weld(ch['Right Arm'],hn,CFrame.new(0,-0.9,-0.4)*ang(mr(-80),0,0))
  396. Tween(rw,cfn()*ang(mr(-80),mr(-30),mr(-10)),0.1)
  397. attacking=false
  398. sheath=true
  399. elseif k=='q' and attacking==false and sheath==true then
  400. attacking=true
  401. Tween(lw,cfn(),0.2)
  402.  
  403. Tween(rw,cfn()*ang(mr(-179),0,0),0.1)
  404. hw:Destroy()
  405. hw=weld(torso,hn,CFrame.new(0.4,0.8,0.8)*ang(0,0,mr(135)))
  406. Tween(rw,cfn()*ang(mr(30),mr(-30),0),0.1)
  407.  
  408. mw:Destroy()
  409. mw=weld(ch['Right Arm'],shaft,CFrame.new(0,-1.9,-1)*ang(mr(-45),mr(-14),0))
  410.  
  411. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  412. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  413. attacking=false
  414. sheath=false
  415. end
  416. end)
Add Comment
Please, Sign In to add comment