mooodi1234

Spray can

Apr 8th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.12 KB | None | 0 0
  1.  
  2. plr=game:service'Players'.LocalPlayer ch=plr.Character tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint m,mouse=plr:GetMouse(),plr:GetMouse() cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new clr='White' sz=0.2 mag=0.5 undotable={} if ch:findFirstChild("Draw") then ch.Draw:Destroy() end local tube=int("Model",ch) tube.Name='Draw' getSound=function(id) local s=int("Sound",ch.Head) s.Volume=1 s.SoundId=id return s end local spray=getSound('rbxassetid://137065982') spray.Volume=0.5 Weld = function(p0,p1,x,y,z,rx,ry,rz,par) 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 weld=function(p0,p1,c0) local w=Instance.new("Weld",p0) w.Part0=p0 w.Part1=p1 w.C0=c0 return w end cp=function(parent,color,size,anchored,cancollide) local newp=Instance.new("Part",parent) newp.TopSurface='Smooth' newp.BottomSurface='Smooth' newp.FormFactor="Custom" newp.Material='SmoothPlastic' 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) ypcall(function() 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 cyl=function(prt) local c=int("CylinderMesh",prt) return c end blo=function(prt) local c=int("BlockMesh",prt) return c 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) mh=cp(tube,"White",Vector3.new(0.6,1,0.6)) cyl(mh) mw=weld(ch['Right Arm'],mh,cfn(0,-1,0)*ang(mr(-90),0,0)) mha=cp(tube,"Really black",Vector3.new(0.6,0.2,0.6)) cyl(mha).Scale=Vector3.new(0.85,1,0.85) weld(mh,mha,cfn(0,0.6,0)) local pz=cp(tube,"White",Vector3.new(0.6,0.2,0.6)) cyl(pz).Scale=Vector3.new(0.9,0.4,0.9) weld(mha,pz,cfn(0,0,0)) local p=cp(tube,"Dark stone grey",Vector3.new(0.6,0.2,0.6)) cyl(p).Scale=Vector3.new(0.95,0.4,0.95) weld(mh,p,cfn(0,0.5,0)) local pa=cp(tube,"Dark stone grey",Vector3.new(0.6,0.3,0.6)) pa.Material='Plastic' cyl(pa).Scale=Vector3.new(1.1,1,1.1) weld(mh,pa,cfn(0,0,0)) local p=cp(tube,"Really black",Vector3.new(0.6,0.2,0.6)) p.Material='Plastic' cyl(p).Scale=Vector3.new(1.05,0.4,1.05) weld(pa,p,cfn(0,0.18,0)) local p=cp(tube,"Really black",Vector3.new(0.6,0.2,0.6)) p.Material='Plastic' cyl(p).Scale=Vector3.new(1.05,0.4,1.05) weld(pa,p,cfn(0,-0.18,0)) mha2=cp(tube,"White",Vector3.new(0.2,0.2,0.2)) cyl(mha2).Scale=Vector3.new(1,1,1) weld(mha,mha2,cfn(0,0,-0.3)*ang(mr(-90),0,0)) mha2b=cp(tube,"Really black",Vector3.new(0.2,0.2,0.2)) cyl(mha2b).Scale=Vector3.new(0.9,1.02,0.9) weld(mha2,mha2b,cfn(0,0,0)*ang(0,0,0)) local filtr=int("Model",ch) filtr.Name='TargetFilter' m.TargetFilter=filtr drawLine=function(point_a,point_b,bc_code) local dist=(point_a-point_b).magnitude; local rad=dist/2; local line=Instance.new('Part',filtr) line.Anchored=true; line.FormFactor='Custom'; line.Transparency=0.4 line.Color=BrickColor.new(bc_code).Color; line.CanCollide=false; line.Size=Vector3.new(sz,.1,dist); Instance.new("BlockMesh",line).Name='blok' line.CFrame=CFrame.new(point_a,point_b)*CFrame.new(0,0,-rad); return line; end; draw=false mha3=nil m.Button1Down:connect(function() if sheathed==false then for _,v in pairs(undotable) do ypcall(function() for i=1,10 do table.remove(undotable,_) end end) table.remove(undotable,_) end draw=true spray.Looped=true spray:Play() mha3=cp(tube,clr,Vector3.new(0.2,0.2,0.2),true,false) cyl(mha3).Scale=Vector3.new(1,1,1) position=m.Hit game:service'RunService'.RenderStepped:connect(function() position=m.Hit local distance = (position.p - mha2.CFrame.p).magnitude mha3.Size=Vector3.new(0.2,distance,02) mha3.CFrame=CFrame.new(position.p, mha2.CFrame.p) * CFrame.new(0, 0, -distance/2)*ang(mr(-90),0,0) end) end end) m.Button1Up:connect(function() spray:Stop() spray.Looped=false draw=false ypcall(function() mha3:Destroy() end) end) plr.Chatted:connect(function(chat) if chat:sub(1,4)=='clr;' and sheathed==false then ypcall(function() clr=string.sub(chat,5) mh.BrickColor=BrickColor.new(clr) pz.BrickColor=BrickColor.new(clr) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) end) elseif chat:sub(1,3)=='sz;' then sz=tonumber(string.sub(chat,4)) elseif chat:sub(1,4)=='mag;' then mag=tonumber(string.sub(chat,5)) end end) tttable={} sheathed=false m.KeyUp:connect(function(key) if key=='z' then for i=1,10 do for _,v in pairs(undotable) do v:Destroy() table.remove(undotable,_) end end elseif key=='c' then for i=1,10 do for _,v in pairs(tttable) do ypcall(function() v:Destroy() end) table.remove(tttable,_) end end elseif key=='e' and sheathed==false then clr=tostring(BrickColor.Random()) mh.BrickColor=BrickColor.new(clr) pz.BrickColor=BrickColor.new(clr) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) elseif key=='q' and sheathed==false then Tween(rw,cfn()*ang(0,0,0),0.2) mw:Destroy() mw=weld(torso,mh,CFrame.new(1.3,-1.6,0.16)*ang(math.rad(-30),0,0)) rabr:Destroy() w:Destroy() labr:Destroy() ww:Destroy() sheathed=true elseif key=='q' and sheathed==true then mw:Destroy() ypcall(function() mw:Destroy() end) mw=weld(ch['Right Arm'],mh,cfn(0,-1,0)*ang(mr(-90),0,0)) 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) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10))) sheathed=false end end) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10))) last=m.Hit game:service'RunService'.RenderStepped:connect(function() if draw==false then last=m.Hit Tween(rw,cfn()*ang(mr(-70),mr(-40),0),0.02) Tween(rw,cfn()*ang(mr(-60),mr(-30),0),0.02) else ypcall(function() if m.Target and m.Target.Parent and m.Target.Parent:findFirstChild('Humanoid') then m.Target.Parent.Humanoid:TakeDamage(1) end end) coroutine.resume(coroutine.create(function() if m.Hit and m.Target then local c=m.Hit local m=(c.p-last.p).magnitude; if(m>mag)then local l=drawLine(last.p,c.p,clr); Instance.new("PointLight",l).Color=l.BrickColor.Color l.Material='Neon' table.insert(undotable,l) table.insert(tttable,l) last=c; end; end end)); end end) --hl/https://httpget-inumeration.c9.io/spraycan.lua
Add Comment
Please, Sign In to add comment