Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- plr=game:service'Players'.LocalPlayer
- ch=plr.Character
- torso=ch.Torso
- m=plr:GetMouse()
- cfn=CFrame.new
- mr=math.rad
- ang=CFrame.Angles
- int=Instance.new
- loaded=6
- ammo=36
- if ch:findFirstChild('Scattergun') then
- ch.Scattergun:Destroy()
- end
- local shoot=int("Sound",ch.Head)
- shoot.SoundId='http://www.roblox.com/asset?id=10209828'
- shoot.Volume=1
- shoot.Pitch = 1
- local click=int("Sound",ch.Head)
- click.SoundId='http://www.roblox.com/asset?id=10209834'
- click.Volume=1
- click.Pitch=1
- game:service'ContentProvider':Preload(shoot.SoundId)
- game:service'ContentProvider':Preload(click.SoundId)
- local tube=Instance.new("Model",ch)
- tube.Name='Scattergun'
- function weld(p0,p1,c0)--basic weld function
- local w=Instance.new("Weld",p0)
- w.Part0=p0
- w.Part1=p1
- w.C0=c0
- return w
- end
- 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.
- p0.Position = p1.Position
- local w = Instance.new('Motor',par or p0)
- w.Part0 = p1
- w.Part1 = p0
- w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
- w.MaxVelocity = .1
- return w
- end
- function cp(parent,color,size,anchored,cancollide)--creates a part. automagically returns the part so you can edit it manually.
- local newp=Instance.new("Part",parent)
- newp.Material = "SmoothPlastic"
- newp.TopSurface=10
- newp.BottomSurface=10
- newp.LeftSurface=10
- newp.RightSurface=10
- newp.BackSurface=10
- newp.FrontSurface=10
- newp.FormFactor="Custom"
- newp.BrickColor=BrickColor.new(color)
- newp.Size=size
- newp.Anchored=anchored
- newp.CanCollide=cancollide
- newp:BreakJoints()
- return newp
- end
- Tween = function(Weld, Stop, Step,a)--epik tween function. simple, no lag, awesome.
- ypcall(function()--- TweenWeld function (not made by me)
- local func = function()
- local Start = Weld.C1
- local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
- local Stop = Stop
- local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
- for i = 0, 1, Step or .1 do
- Weld.C1 = CFrame.new( (Start.p.X * (1 - i)) + (Stop.p.X * i),
- (Start.p.Y * (1 - i)) + (Stop.p.Y * i),
- (Start.p.Z * (1 - i)) + (Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
- (X1 * (1 - i)) + (X2 * i), (Y1 * (1 - i)) + (Y2 * i),
- (Z1 * (1 - i)) + (Z2 * i) )
- wait()
- end
- Weld.C1 = Stop
- end
- if a then coroutine.wrap(func)() else func() end
- end)
- end
- rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
- rabr.Position = torso.Position
- rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
- w = Instance.new("Weld",tube)
- w.Part0,w.Part1 = ch['Right Arm'],rabr
- w.C1 = CFrame.new(0,-.5,0)
- labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
- labr.Position = torso.Position
- lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
- ww = Instance.new("Weld",tube)
- ww.Part0,ww.Part1 = ch['Left Arm'],labr
- ww.C1 = CFrame.new(0,-.5,0)
- local shaft=cp(tube,"Brown",Vector3.new(1,1,1))
- shaft.Material='Wood'
- local mw=weld(ch['Right Arm'],shaft,CFrame.new(0,-1.9,-1)*ang(mr(-45),mr(-14),0))
- local blk=int('BlockMesh',shaft)
- blk.Scale=Vector3.new(0.5,0.2,1)
- local shaft2=cp(tube,"Brown",Vector3.new(1,1,1))
- weld(shaft,shaft2,CFrame.new(0,0,-0.65)*ang(mr(-90),0,0))
- shaft2.Material="Wood"
- local blk=int('SpecialMesh',shaft2)
- blk.MeshType='Wedge'
- blk.Scale=Vector3.new(0.5,0.3,0.2)
- --[[
- local shaft3=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- weld(shaft,shaft3,CFrame.new(0,1,-0.65)*ang(mr(45),0,0)*CFrame.new(0,0,0)*ang(0,mr(30),0))
- local blk=int('SpecialMesh',shaft3)
- blk.MeshType='Wedge'
- blk.Scale=Vector3.new(0.5,0.2,0.2)
- ]]
- local cyla=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- Instance.new("CylinderMesh",cyla).Scale=Vector3.new(0.71,0.5,0.71)
- cyla.Reflectance=0.1
- weld(shaft,cyla,CFrame.new(0,0.094,0.59)*ang(mr(90),0,0))
- local bh=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- weld(cyla,bh,CFrame.new(0,0.5,0))
- bh.Reflectance=0.1
- local blk=int('BlockMesh',bh)
- blk.Scale=Vector3.new(0.23,0.5,0.32)
- local bh2=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- weld(bh,bh2,CFrame.new(0,0.27,0.02)*ang(mr(16),0,0))
- bh2.Reflectance=0.1
- local blk=int('BlockMesh',bh2)
- blk.Scale=Vector3.new(0.23,0.2,0.32)
- local bh3=cp(tube,"Brown",Vector3.new(1,1,1))
- bh3.Material='Wood'
- weld(bh,bh3,CFrame.new(0,0.5,0.1)*ang(mr(20),0,0))
- local blk=int('BlockMesh',bh3)
- blk.Scale=Vector3.new(0.23,0.4,0.32)
- local bh4=cp(tube,"Really black",Vector3.new(1,1,1))
- weld(bh,bh4,CFrame.new(0,-0.1,0.27)*ang(0,0,0))
- local blk=int('BlockMesh',bh4)
- blk.Scale=Vector3.new(0.1,0.1,0.2)
- local bh5=cp(tube,"Really black",Vector3.new(1,1,1))
- weld(bh4,bh5,CFrame.new(0,0.06,0.06)*ang(0,0,0))
- local blk=int('BlockMesh',bh5)
- blk.Scale=Vector3.new(0.1,0.2,0.1)
- local bh5=cp(tube,"Really black",Vector3.new(1,1,1))
- weld(bh4,bh5,CFrame.new(0,0.3,0)*ang(mr(-20),0,0))
- local blk=int('BlockMesh',bh5)
- blk.Scale=Vector3.new(0.1,0.4,0.1)
- local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
- cyl.Reflectance=0.1
- weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
- local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
- cyl.Reflectance=0.1
- weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
- local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
- Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
- cyl.Reflectance=0.1
- weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
- local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
- Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
- cyl.Reflectance=0.1
- weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
- local cyl1=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- Instance.new("BlockMesh",cyl1).Scale=Vector3.new(0.18,1.48,0.1)
- cyl.Reflectance=0.1
- weld(shaft,cyl1,CFrame.new(0,0.31,-0.37)*ang(mr(90),0,0))
- local cylz=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- Instance.new("BlockMesh",cylz).Scale=Vector3.new(0.09,0.14,0.1)
- cylz.Reflectance=0.1
- weld(shaft,cylz,CFrame.new(0,0.37,-0.97)*ang(0,0,0))
- local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
- cyl.Reflectance=0.1
- weld(shaft,cyl,CFrame.new(0.06,0.37,0.135)*ang(0,0,0))
- local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
- Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
- cyl.Reflectance=0.1
- weld(shaft,cyl,CFrame.new(-0.06,0.37,0.135)*ang(0,0,0))
- --[[local hn=cp(tube,"Dark stone grey",Vector3.new(0.2,0.7,0.2))
- hw=weld(ch.Head,hn,CFrame.new(0,4,0))
- Instance.new("CylinderMesh",hn)
- local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
- Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
- weld(hn,rng,CFrame.new(0,0.3,0))
- local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
- Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
- weld(hn,rng,CFrame.new(0,0.2,0))
- local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
- Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
- weld(hn,rng,CFrame.new(0,0.1,0))
- local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
- Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
- weld(hn,rng,CFrame.new(0,0,0))
- local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
- Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
- weld(hn,rng,CFrame.new(0,-0.1,0))
- local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
- Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
- weld(hn,rng,CFrame.new(0,-0.2,0))]]
- Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
- Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
- attacking=false
- createBullet=function()
- local radz=math.random(math.random(8,11),math.random(12,15))
- local asd=m.Hit.lookVector
- local vel=Vector3.new(math.random(2,radz),math.random(1,radz),math.random(1,radz))+asd*350
- print'sn'
- local b=cp(tube,"Really black",Vector3.new(0.4,0.4,0.4))
- print'sn'
- local sp=int("SpecialMesh",b)
- sp.MeshType='Sphere'
- b.CFrame=cylz.CFrame
- b.Velocity=vel
- b.Touched:connect(function(p)
- if p.Parent:findFirstChild("Humanoid") then
- p.Parent.Humanoid:TakeDamage(6)
- b:Destroy()
- end
- end)
- end
- loadBullet=function()
- Tween(lw,cfn(0,0.6,0)*ang(mr(-68),mr(60),0),0.2)
- click:Play()
- loaded=loaded+1
- ammo=ammo-1
- Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.2)
- end
- m.Button1Down:connect(function()
- if attacking==false and loaded>0 then
- loaded=loaded-1
- attacking=true
- Spawn(function()
- Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-55),mr(30),0),0.4)
- end)
- Tween(rw,cfn(0,0,0)*ang(mr(-55),mr(-30),0),0.4)
- for i=1,4 do
- createBullet()
- end
- local shell=cp(workspace,"Really red",Vector3.new(0.2,0.2,0.4))
- shell.Position=cyla.Position
- shoot:Play()
- Spawn(function()
- Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.4)
- end)
- Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.4)
- wait(0.1)
- attacking=false
- elseif attacking==false and loaded<=0 then
- attacking=true
- Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
- Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
- for i=1,6 do
- loadBullet()
- end
- Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
- Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
- attacking=false
- end
- end)
- m.KeyDown:connect(function(k)
- if k=='r' and attacking==false then
- attacking=true
- Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
- Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
- for i=1,6-loaded do
- loadBullet()
- end
- Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
- Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
- attacking=false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement