Advertisement
memberhero

Untitled

Aug 7th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.24 KB | None | 0 0
  1. plr=game:service'Players'.LocalPlayer
  2. ch=plr.Character
  3. torso=ch.Torso
  4. m=plr:GetMouse()
  5. cfn=CFrame.new
  6. mr=math.rad
  7. ang=CFrame.Angles
  8. int=Instance.new
  9.  
  10. loaded=6
  11. ammo=36
  12.  
  13. if ch:findFirstChild('Scattergun') then
  14. ch.Scattergun:Destroy()
  15. end
  16.  
  17. local shoot=int("Sound",ch.Head)
  18. shoot.SoundId='http://www.roblox.com/asset?id=10209828'
  19. shoot.Volume=1
  20. shoot.Pitch = 1
  21.  
  22. local click=int("Sound",ch.Head)
  23. click.SoundId='http://www.roblox.com/asset?id=10209834'
  24. click.Volume=1
  25. click.Pitch=1
  26. game:service'ContentProvider':Preload(shoot.SoundId)
  27. game:service'ContentProvider':Preload(click.SoundId)
  28.  
  29.  
  30. local tube=Instance.new("Model",ch)
  31. tube.Name='Scattergun'
  32.  
  33. function weld(p0,p1,c0)--basic weld function
  34. local w=Instance.new("Weld",p0)
  35. w.Part0=p0
  36. w.Part1=p1
  37. w.C0=c0
  38. return w
  39. end
  40.  
  41. 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.
  42. p0.Position = p1.Position
  43. local w = Instance.new('Motor',par or p0)
  44. w.Part0 = p1
  45. w.Part1 = p0
  46. w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
  47. w.MaxVelocity = .1
  48. return w
  49. end
  50.  
  51.  
  52. function cp(parent,color,size,anchored,cancollide)--creates a part. automagically returns the part so you can edit it manually.
  53. local newp=Instance.new("Part",parent)
  54. newp.Material = "SmoothPlastic"
  55. newp.TopSurface=10
  56. newp.BottomSurface=10
  57. newp.LeftSurface=10
  58. newp.RightSurface=10
  59. newp.BackSurface=10
  60. newp.FrontSurface=10
  61. newp.FormFactor="Custom"
  62. newp.BrickColor=BrickColor.new(color)
  63. newp.Size=size
  64. newp.Anchored=anchored
  65. newp.CanCollide=cancollide
  66. newp:BreakJoints()
  67. return newp
  68. end
  69.  
  70. Tween = function(Weld, Stop, Step,a)--epik tween function. simple, no lag, awesome.
  71. ypcall(function()--- TweenWeld function (not made by me)
  72. local func = function()
  73. local Start = Weld.C1
  74. local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
  75. local Stop = Stop
  76. local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
  77.  
  78. for i = 0, 1, Step or .1 do
  79. Weld.C1 = CFrame.new( (Start.p.X * (1 - i)) + (Stop.p.X * i),
  80. (Start.p.Y * (1 - i)) + (Stop.p.Y * i),
  81. (Start.p.Z * (1 - i)) + (Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
  82. (X1 * (1 - i)) + (X2 * i), (Y1 * (1 - i)) + (Y2 * i),
  83. (Z1 * (1 - i)) + (Z2 * i) )
  84. wait()
  85. end
  86.  
  87. Weld.C1 = Stop
  88. end
  89.  
  90. if a then coroutine.wrap(func)() else func() end
  91. end)
  92. end
  93.  
  94. rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
  95. rabr.Position = torso.Position
  96. rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
  97. w = Instance.new("Weld",tube)
  98. w.Part0,w.Part1 = ch['Right Arm'],rabr
  99. w.C1 = CFrame.new(0,-.5,0)
  100.  
  101. labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
  102. labr.Position = torso.Position
  103. lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
  104. ww = Instance.new("Weld",tube)
  105. ww.Part0,ww.Part1 = ch['Left Arm'],labr
  106. ww.C1 = CFrame.new(0,-.5,0)
  107.  
  108.  
  109. local shaft=cp(tube,"Brown",Vector3.new(1,1,1))
  110. shaft.Material='Wood'
  111. local mw=weld(ch['Right Arm'],shaft,CFrame.new(0,-1.9,-1)*ang(mr(-45),mr(-14),0))
  112. local blk=int('BlockMesh',shaft)
  113. blk.Scale=Vector3.new(0.5,0.2,1)
  114.  
  115. local shaft2=cp(tube,"Brown",Vector3.new(1,1,1))
  116. weld(shaft,shaft2,CFrame.new(0,0,-0.65)*ang(mr(-90),0,0))
  117. shaft2.Material="Wood"
  118. local blk=int('SpecialMesh',shaft2)
  119. blk.MeshType='Wedge'
  120. blk.Scale=Vector3.new(0.5,0.3,0.2)
  121.  
  122. --[[
  123. local shaft3=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  124. weld(shaft,shaft3,CFrame.new(0,1,-0.65)*ang(mr(45),0,0)*CFrame.new(0,0,0)*ang(0,mr(30),0))
  125. local blk=int('SpecialMesh',shaft3)
  126. blk.MeshType='Wedge'
  127. blk.Scale=Vector3.new(0.5,0.2,0.2)
  128. ]]
  129.  
  130. local cyla=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  131. Instance.new("CylinderMesh",cyla).Scale=Vector3.new(0.71,0.5,0.71)
  132. cyla.Reflectance=0.1
  133. weld(shaft,cyla,CFrame.new(0,0.094,0.59)*ang(mr(90),0,0))
  134. local bh=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  135. weld(cyla,bh,CFrame.new(0,0.5,0))
  136. bh.Reflectance=0.1
  137. local blk=int('BlockMesh',bh)
  138. blk.Scale=Vector3.new(0.23,0.5,0.32)
  139. local bh2=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  140. weld(bh,bh2,CFrame.new(0,0.27,0.02)*ang(mr(16),0,0))
  141. bh2.Reflectance=0.1
  142. local blk=int('BlockMesh',bh2)
  143. blk.Scale=Vector3.new(0.23,0.2,0.32)
  144. local bh3=cp(tube,"Brown",Vector3.new(1,1,1))
  145. bh3.Material='Wood'
  146. weld(bh,bh3,CFrame.new(0,0.5,0.1)*ang(mr(20),0,0))
  147. local blk=int('BlockMesh',bh3)
  148. blk.Scale=Vector3.new(0.23,0.4,0.32)
  149. local bh4=cp(tube,"Really black",Vector3.new(1,1,1))
  150. weld(bh,bh4,CFrame.new(0,-0.1,0.27)*ang(0,0,0))
  151. local blk=int('BlockMesh',bh4)
  152. blk.Scale=Vector3.new(0.1,0.1,0.2)
  153. local bh5=cp(tube,"Really black",Vector3.new(1,1,1))
  154. weld(bh4,bh5,CFrame.new(0,0.06,0.06)*ang(0,0,0))
  155. local blk=int('BlockMesh',bh5)
  156. blk.Scale=Vector3.new(0.1,0.2,0.1)
  157. local bh5=cp(tube,"Really black",Vector3.new(1,1,1))
  158. weld(bh4,bh5,CFrame.new(0,0.3,0)*ang(mr(-20),0,0))
  159. local blk=int('BlockMesh',bh5)
  160. blk.Scale=Vector3.new(0.1,0.4,0.1)
  161.  
  162.  
  163.  
  164.  
  165. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  166. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
  167. cyl.Reflectance=0.1
  168. weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
  169. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  170. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
  171. cyl.Reflectance=0.1
  172. weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
  173.  
  174. local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
  175. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
  176. cyl.Reflectance=0.1
  177. weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
  178. local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
  179. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
  180. cyl.Reflectance=0.1
  181. weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
  182.  
  183. local cyl1=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  184. Instance.new("BlockMesh",cyl1).Scale=Vector3.new(0.18,1.48,0.1)
  185. cyl.Reflectance=0.1
  186. weld(shaft,cyl1,CFrame.new(0,0.31,-0.37)*ang(mr(90),0,0))
  187.  
  188. local cylz=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  189. Instance.new("BlockMesh",cylz).Scale=Vector3.new(0.09,0.14,0.1)
  190. cylz.Reflectance=0.1
  191. weld(shaft,cylz,CFrame.new(0,0.37,-0.97)*ang(0,0,0))
  192.  
  193. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  194. Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
  195. cyl.Reflectance=0.1
  196. weld(shaft,cyl,CFrame.new(0.06,0.37,0.135)*ang(0,0,0))
  197. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  198. Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
  199. cyl.Reflectance=0.1
  200. weld(shaft,cyl,CFrame.new(-0.06,0.37,0.135)*ang(0,0,0))
  201.  
  202. --[[local hn=cp(tube,"Dark stone grey",Vector3.new(0.2,0.7,0.2))
  203. hw=weld(ch.Head,hn,CFrame.new(0,4,0))
  204. Instance.new("CylinderMesh",hn)
  205.  
  206. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  207. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  208. weld(hn,rng,CFrame.new(0,0.3,0))
  209. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  210. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  211. weld(hn,rng,CFrame.new(0,0.2,0))
  212. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  213. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  214. weld(hn,rng,CFrame.new(0,0.1,0))
  215. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  216. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  217. weld(hn,rng,CFrame.new(0,0,0))
  218. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  219. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  220. weld(hn,rng,CFrame.new(0,-0.1,0))
  221. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  222. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  223. weld(hn,rng,CFrame.new(0,-0.2,0))]]
  224.  
  225.  
  226.  
  227.  
  228. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  229. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  230.  
  231. attacking=false
  232.  
  233. createBullet=function()
  234. local radz=math.random(math.random(8,11),math.random(12,15))
  235. local asd=m.Hit.lookVector
  236. local vel=Vector3.new(math.random(2,radz),math.random(1,radz),math.random(1,radz))+asd*350
  237. print'sn'
  238. local b=cp(tube,"Really black",Vector3.new(0.4,0.4,0.4))
  239. print'sn'
  240. local sp=int("SpecialMesh",b)
  241. sp.MeshType='Sphere'
  242. b.CFrame=cylz.CFrame
  243. b.Velocity=vel
  244. b.Touched:connect(function(p)
  245. if p.Parent:findFirstChild("Humanoid") then
  246. p.Parent.Humanoid:TakeDamage(6)
  247. b:Destroy()
  248. end
  249. end)
  250. end
  251.  
  252. loadBullet=function()
  253. Tween(lw,cfn(0,0.6,0)*ang(mr(-68),mr(60),0),0.2)
  254. click:Play()
  255. loaded=loaded+1
  256. ammo=ammo-1
  257. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.2)
  258. end
  259.  
  260. m.Button1Down:connect(function()
  261. if attacking==false and loaded>0 then
  262. loaded=loaded-1
  263. attacking=true
  264. Spawn(function()
  265. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-55),mr(30),0),0.4)
  266. end)
  267. Tween(rw,cfn(0,0,0)*ang(mr(-55),mr(-30),0),0.4)
  268. for i=1,4 do
  269. createBullet()
  270. end
  271. local shell=cp(workspace,"Really red",Vector3.new(0.2,0.2,0.4))
  272. shell.Position=cyla.Position
  273. shoot:Play()
  274. Spawn(function()
  275. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.4)
  276. end)
  277. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.4)
  278. wait(0.1)
  279. attacking=false
  280. elseif attacking==false and loaded<=0 then
  281. attacking=true
  282. Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
  283. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
  284. for i=1,6 do
  285. loadBullet()
  286. end
  287. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  288. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  289. attacking=false
  290. end
  291. end)
  292.  
  293. m.KeyDown:connect(function(k)
  294. if k=='r' and attacking==false then
  295. attacking=true
  296. Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
  297. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
  298. for i=1,6-loaded do
  299. loadBullet()
  300. end
  301. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  302. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  303. attacking=false
  304. end
  305. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement