SHOW:
|
|
- or go back to the newest paste.
| 1 | -- mediafire | |
| 2 | --[[ TBTurret ]]-- | |
| 3 | math.randomseed(tick()) Colors={"Bright red","Really red","Bright yellow","Bright orange","New Yeller","Deep orange","Neon orange"}
| |
| 4 | V3 = Vector3.new C3 = Color3.new BN = BrickColor.new CN = CFrame.new CA = CFrame.Angles MR = math.rad MRA = math.random MP = math.pi MH = math.huge UD = UDim2.new | |
| 5 | TI = table.insert TR = table.remove CR = coroutine.resume CC = coroutine.create it = Instance.new Sound = "http://www.roblox.com/asset/?id=81116747" Fire="http://www.roblox.com/asset/?id=10209821" cn = CN rd = MR ca = CA rn = MRA v3 = V3 | |
| 6 | me = game.Players.LocalPlayer Hold = false Sitting = false DecalBulletHole = "http://www.roblox.com/asset/?id=64291961" pcall(function()me.Character.Humanoid.MaxHealth=500 wait() me.Character.Humanoid.Health=500 end) | |
| 7 | stick = function(hit2,hit) local weld=Instance.new("Weld") weld.Part0=hit2 weld.Part1=hit local HitPos=hit2.Position local CJ=CN(HitPos) local C0=hit2.CFrame:inverse() *CJ local C1=hit.CFrame:inverse() * CJ weld.C0=C0 weld.C1=C1 weld.Parent=hit2 end
| |
| 8 | function Part(Par, Anc, Colli, Tran, Ref, Col, Siz, Mat, Type) local p = it("Part") p.formFactor = "Custom" p.TopSurface = 0 p.BottomSurface = 0 p.Transparency = Tran p.Reflectance = Ref p.Anchored = Anc p.CanCollide = Colli p.BrickColor = Col p.Size = Siz p.Material = Mat or "Plastic" p.Locked = true if Type == "Wedge" then it("SpecialMesh",p).MeshType = "Wedge" elseif Type == "Sphere" then it("SpecialMesh",p).MeshType = "Sphere" elseif Type == "Cylinder" then it("CylinderMesh",p) elseif Type == "Block" then it("BlockMesh",p) end p.Parent = Par p:BreakJoints() return p end
| |
| 9 | RocketExplode=it("Sound",me.Character.Torso) RocketExplode.SoundId=Sound RocketExplode.Volume=1 RocketExplode.Pitch=1
| |
| 10 | Fiyah=it("Sound",me.Character.Torso) Fiyah.SoundId=Fire Fiyah.Volume=1 Fiyah.Pitch=1 cam=workspace.CurrentCamera for i,v in pairs(cam:children()) do v:Remove() end
| |
| 11 | Crown="http://www.roblox.com/asset/?id=20329976" Spike="http://www.roblox.com/asset/?id=1033714" | |
| 12 | ray = function(Pos,Dir,xxz) local xxz2=c if not xxz then xxz2=nil end return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit*999),xxz2) end | |
| 13 | function Blast(Color,Offset) | |
| 14 | local bp=Part(mod,true,false,0,0.15,BN(Colors[math.random(1,#Colors)]),V3(1,1,1),"Plastic") bp.Name="Blast" local bm=it("SpecialMesh",bp) bm.MeshId=Crown bm.Scale=v3(5,4,5) bp.CFrame=Offset
| |
| 15 | q(function() | |
| 16 | for i=-0.2,1,0.12 do | |
| 17 | bp.Transparency=i+0.1 | |
| 18 | bm.Scale=V3(1+(5*1)*i, (2.4*1)+1*i, 1+(5*1)*i) | |
| 19 | wait() | |
| 20 | end | |
| 21 | game:GetService("Debris"):AddItem(bp)
| |
| 22 | end) | |
| 23 | end | |
| 24 | --TURRET BUILDING | |
| 25 | pcall(function()me.Character["Turret"]:Remove()end) | |
| 26 | mod = it("Model",me.Character)mod.Name="Turret"
| |
| 27 | base = Part(mod,true,true,0,0,BN("Medium grey"),V3(6,1,6),"Plastic","Cylinder")
| |
| 28 | p1 = Part(mod,true,true,0,0,BN("Medium grey"),V3(1,4,1),"Plastic","Cylinder")
| |
| 29 | seat = Part(mod,true,true,0,0,BN("Medium grey"),V3(2,0.5,2.5),"Plastic","Block")
| |
| 30 | seatb = Part(mod,true,true,0,0,BN("Medium grey"),V3(2,3,.5),"Plastic","Block")
| |
| 31 | seatattachment = Part(mod,true,true,0,0,BN("Medium grey"),V3(1,4,1),"Plastic","Cylinder")
| |
| 32 | seatatball1=Part(mod,true,true,0,0,BN("Medium grey"),V3(2,2,2),"Plastic","Sphere")
| |
| 33 | seatattachment2 = Part(mod,true,true,0,0,BN("Medium grey"),V3(1,5,1),"Plastic","Cylinder")
| |
| 34 | seatatball2=Part(mod,true,true,0,0,BN("Medium grey"),V3(2,2,2),"Plastic","Sphere")
| |
| 35 | seatattachment3 = Part(mod,true,true,0,0,BN("Medium grey"),V3(1,5,1),"Plastic","Cylinder")
| |
| 36 | seatatball3=Part(mod,true,true,0,0,BN("Medium grey"),V3(2,2,2),"Plastic","Sphere")
| |
| 37 | seatattachment4 = Part(mod,true,true,0,0,BN("Medium grey"),V3(1,4,1),"Plastic","Cylinder")
| |
| 38 | Ball=Part(mod,true,true,0,0,BN("Medium grey"),V3(2,2,2),"Plastic","Sphere")
| |
| 39 | handp=Part(mod,true,true,0,0,BN("Medium grey"),V3(0.5,2,0.5),"Plastic","Cylinder")
| |
| 40 | Handle=Part(mod,true,true,0,0,BN("Medium grey"),V3(.5,4,.5),"Plastic","Cylinder")
| |
| 41 | Barrel=Part(mod,true,true,0,0,BN("Medium grey"),V3(2,5,2),"Plastic","Cylinder")
| |
| 42 | pit=Part(mod,true,true,0,0,BN("Black"),V3(1.25,1,1.25),"Plastic","Cylinder")
| |
| 43 | --TURRET BUILDING | |
| 44 | function Search(Start, Center, Radius) | |
| 45 | function Find(Start, Center, Radius) | |
| 46 | for _, Object in pairs(Start:GetChildren()) do | |
| 47 | Search(Object, Center, Radius) | |
| 48 | Count = 0 | |
| 49 | for _, Humanoid in pairs(Object:GetChildren()) do | |
| 50 | if Humanoid:IsA("Humanoid") then
| |
| 51 | Count = Count + 1 | |
| 52 | end | |
| 53 | end | |
| 54 | ||
| 55 | if Object:IsA("Model") and Count > 0 and Object:FindFirstChild("Torso") ~= nil then
| |
| 56 | if ( Object:FindFirstChild("Torso").Position - Center.Position ).magnitude < Radius then
| |
| 57 | if Object == me.Character or Object:findFirstChild("Humanoid") == nil or Object:findFirstChild("Torso") == nil then return end
| |
| 58 | local bpp = qi({"BodyVelocity",Object.Torso,maxForce=v3(1/0,1/0,1/0),velocity=cn(me.Character.Torso.Position,Object.Torso.Position+v3(0,7.5,0)).lookVector*80}) wait(0.2) bpp:Remove()
| |
| 59 | for _, Humanoid in pairs(Object:GetChildren()) do | |
| 60 | if Humanoid:IsA("Humanoid") then
| |
| 61 | if Humanoid.MaxHealth > 100000 then | |
| 62 | Humanoid.MaxHealth = 100 | |
| 63 | Humanoid.Health = 100 | |
| 64 | end | |
| 65 | Humanoid:TakeDamage(math.random(50, 90)) | |
| 66 | end | |
| 67 | end | |
| 68 | end | |
| 69 | end | |
| 70 | end | |
| 71 | end | |
| 72 | Find(Start, Center, Radius) | |
| 73 | end | |
| 74 | ||
| 75 | s=me.Character.Torso.CFrame | |
| 76 | TurretFace = function(Pos) | |
| 77 | base.CFrame = CN(s.X,s.Y-2.5,s.Z+10) | |
| 78 | p1.CFrame = base.CFrame*CN(0,1.5,0) | |
| 79 | seat.CFrame = CN(base.CFrame.X,base.CFrame.Y+3.5,base.CFrame.Z) seat.CFrame = CN(seat.Position,Pos) | |
| 80 | seatb.CFrame = seat.CFrame*CN(0,1.25,1.25)*CA(MR(15),0,0) | |
| 81 | seatattachment.CFrame=seatb.CFrame*CN(0,0,2)*CA(MR(90),0,0) | |
| 82 | seatatball1.CFrame=seatattachment.CFrame*CN(0,2,0) | |
| 83 | seatattachment2.CFrame=seatatball1.CFrame*CN(0,-1,-2)*CA(MR(65),0,0) | |
| 84 | seatatball2.CFrame=seatattachment2.CFrame*CN(0,-2.5,0) | |
| 85 | seatattachment3.CFrame=seatatball2.CFrame*CN(0,-1,2.5)*CA(MR(-65),0,0) | |
| 86 | seatatball3.CFrame=seatattachment3.CFrame*CN(0,-2.5,0) | |
| 87 | seatattachment4.CFrame=seatatball3.CFrame*CN(0,-.5,2.5)*CA(MR(-80),0,0) | |
| 88 | Ball.CFrame=seatattachment4.CFrame*CN(0,-2,0) | |
| 89 | handp.CFrame=Ball.CFrame*CN(0,0.5,0.75)*ca(rd(65),0,0) | |
| 90 | Handle.CFrame=handp.CFrame*CN(0,1,0)*CA(0,0,MR(90)) | |
| 91 | Barrel.CFrame=seat.CFrame*CN(0,2,-5.25)*CA(MR(90),0,0) | |
| 92 | pit.CFrame=Barrel.CFrame*CN(0,-2.01,0) | |
| 93 | end | |
| 94 | q = function(f) CR(CC(function() f() end)) end | |
| 95 | qi = function(ttz) local qii = it(ttz[1],ttz[2]) table.foreach(ttz,function(oi,oi2) if oi ~= 1 and oi ~= 2 then qii[oi] = oi2 end end) return qii end | |
| 96 | DetectSurface = function(pos, part) local surface = nil local pospos = part.CFrame local pos2 = pospos:pointToObjectSpace(pos) local siz = part.Size local shaep = part.Shape if shaep == Enum.PartType.Ball or shaep == Enum.PartType.Cylinder then surface = {"Anything", CN(pospos.p, pos)*CN(0, 0, -(pospos.p - pos).magnitude+0.12)*CA(MR(-90), 0, 0)} elseif pos2.Y > ((siz.Y/2)-0.01) then surface = {"Top", CA(0, 0, 0)} elseif pos2.Y < -((siz.Y/2)-0.01) then surface = {"Bottom", CA(-math.pi, 0, 0)} elseif pos2.X > ((siz.X/2)-0.01) then surface = {"Right", CA(0, 0, MR(-90))} elseif pos2.X < -((siz.X/2)-0.01) then surface = {"Left", CA(0, 0, MR(90))} elseif pos2.Z > ((siz.Z/2)-0.01) then surface = {"Back", CA(MR(90), 0, 0)} elseif pos2.Z < -((siz.Z/2)-0.01) then surface = {"Front", CA(MR(-90), 0, 0)} end return surface end
| |
| 97 | function Trail(ob,times,waitz,col,thickz,ofz) | |
| 98 | q(function() | |
| 99 | local oldpos=(ob.CFrame *ofz).p | |
| 100 | for i=1,times do | |
| 101 | local obp=(ob.CFrame *ofz).p | |
| 102 | local mag=(oldpos - obp).magnitude | |
| 103 | local tr=Part(ob,false,false,0.5,0.15,BN("White"),v3(0,0,0),"Plastic") tr.Name="Trail"
| |
| 104 | tr.Anchored=true | |
| 105 | tr.CFrame=cn(oldpos,obp) | |
| 106 | tr.CFrame=tr.CFrame + tr.CFrame.lookVector* (mag/2) | |
| 107 | local trm=it("CylinderMesh",tr)
| |
| 108 | trm.Scale=v3(5*thickz,mag*5,5*thickz) | |
| 109 | q(function() | |
| 110 | for i=5*thickz,0,-5*thickz/10 do | |
| 111 | trm.Scale=v3(i,mag*5,i) wait() | |
| 112 | end | |
| 113 | tr:Remove'' | |
| 114 | end) | |
| 115 | tr.CFrame=tr.CFrame *ca(rd(90),0,0) | |
| 116 | oldpos=obp wait(waitz) | |
| 117 | end | |
| 118 | end) | |
| 119 | end | |
| 120 | - | TurretShot = function(offset) |
| 120 | + | gunshotsound = Instance.new("Sound", pistolpart)
|
| 121 | gunshotsound.SoundId = "rbxassetid://213603013" | |
| 122 | - | local muzzle=Part(mod,true,true,0,0,BN(Colors[math.random(1,#Colors)]),V3(1,1,1),"Plastic") |
| 122 | + | mouserotatecharacter = true |
| 123 | - | local muzm=it("SpecialMesh",muzzle) muzm.MeshId=Crown muzzle.CFrame=pit.CFrame*cn(0,-1,-0.25)*ca(0,0,rd(180)) muzm.Scale=v3(1.25,2,1.25)
|
| 123 | + | |
| 124 | - | for i=0,1,0.1 do muzzle.CFrame=pit.CFrame*cn(0,-1-(i/2),-0.25)*ca(0,0,rd(180)) muzzle.Transparency=i muzm.Scale=v3(1+i*0.75,2-i*0.25,1+i*0.75) wait() end muzzle:Remove() |
| 124 | + | |
| 125 | pistol.Equipped:connect(function(mouse) | |
| 126 | mouserotatecharacter = true | |
| 127 | - | local speed = 5 |
| 127 | + | local torso = mee.Character.HumanoidRootPart |
| 128 | - | local bb = Part(mod,true,true,0,0,BN("Really black"),V3(0.6,1.5,0.6),"Plastic","Cylinder")
|
| 128 | + | local mouseturning = mee:GetMouse() |
| 129 | - | bb.CFrame = offset*CN(0,2.8+(MRA(0,30)/10),0) q(function() bb2=bb:Clone() bb2.Parent=workspace.CurrentCamera while wait() do pcall(function() bb2.CFrame=bb.CFrame end) end end) |
| 129 | + | mee.Character.Humanoid.AutoRotate = false |
| 130 | - | wait() --workspace.CurrentCamera.CameraSubject=bb |
| 130 | + | mouseturning.Move:connect(function() |
| 131 | - | Trail(bb,100,0,BN("White"),1,CN(0,0,0))
|
| 131 | + | if mouserotatecharacter == true then |
| 132 | - | for i=1,math.huge do |
| 132 | + | torso.CFrame = CFrame.new(torso.Position, mouseturning.Hit.p*Vector3.new(1,0,1) + torso.Position*Vector3.new(0, 1, 0)) |
| 133 | - | bb.CFrame=bb.CFrame*CN(0,speed,0)*CA(MR(-0.2),0,0) -- try putting this before bhit and bpos |
| 133 | + | |
| 134 | - | bhit,bpos=ray(bb.Position,bb.Position - (bb.CFrame *CN(0,-1,0)).p) |
| 134 | + | |
| 135 | - | if bhit and bpos and (bpos - bb.Position).magnitude < speed and bhit.Name~="Trail" and bhit.Name~="Blast" then |
| 135 | + | |
| 136 | - | break |
| 136 | + | mouse.Button1Down:connect(function() |
| 137 | - | end |
| 137 | + | gunshotsound:Play() |
| 138 | MakeShell() | |
| 139 | local ray = Ray.new(pistol.Handle.CFrame.p, (mouse.Hit.p - pistol.Handle.CFrame.p).unit * 300) | |
| 140 | - | Search(Workspace, bb, 10) Blast("Black",bb.CFrame*cn(0,0,1)*ca(rd(90),0,0)) RocketExplode:Play()
|
| 140 | + | local part, position = workspace:FindPartOnRay(ray, mee.Character, false, true) |
| 141 | - | if bhit.Name~="Base" and not bhit.Parent:FindFirstChild("Humanoid") then
|
| 141 | + | |
| 142 | - | bhit.Anchored = false bhit:BreakJoints() |
| 142 | + | local beam = Instance.new("Part", workspace)
|
| 143 | - | local bpp = qi({"BodyVelocity",bhit,maxForce=v3(1/0,1/0,1/0),velocity=cn(me.Character.Torso.Position,bhit.Position+v3(0,7.5,0)).lookVector*80}) wait(0.2) bpp:Remove()
|
| 143 | + | beam.BrickColor = BrickColor.new("White")
|
| 144 | beam.FormFactor = "Custom" | |
| 145 | - | bb.Anchored = false |
| 145 | + | beam.Material = "Neon" |
| 146 | - | if bhit ~= bb and bhit.Name~="Trail" and bhit.Name ~="Blast" then |
| 146 | + | beam.Transparency = 0.7 |
| 147 | - | stick(bb,bhit) |
| 147 | + | beam.Anchored = true |
| 148 | beam.Locked = true | |
| 149 | - | q(function() wait(3) bb:Remove() end) |
| 149 | + | beam.CanCollide = false |
| 150 | ||
| 151 | local distance = (pistol.Handle.CFrame.p - position).magnitude | |
| 152 | beam.Size = Vector3.new(0.3, 0.3, distance) | |
| 153 | - | if script.Parent.className ~= "HopperBin" then h = Instance.new("HopperBin",me.Backpack) h.Name = "Turret" end
|
| 153 | + | beam.CFrame = CFrame.new(pistol.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) |
| 154 | - | Shoot = function() TurretShot(Barrel.CFrame*CA(MR(180),0,0)) end |
| 154 | + | |
| 155 | - | TurretFace(V3(0,1,10)) |
| 155 | + | game:GetService("Debris"):AddItem(beam, 0.1)
|
| 156 | - | h.Selected:connect(function(Mouse) canfire=true Sitting=true |
| 156 | + | |
| 157 | if part then | |
| 158 | - | while wait() do |
| 158 | + | local humanoid = part.Parent:FindFirstChild("Humanoid")
|
| 159 | - | TurretFace(Mouse.Hit.p) |
| 159 | + | |
| 160 | if not humanoid then | |
| 161 | humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
| |
| 162 | end | |
| 163 | ||
| 164 | if humanoid then | |
| 165 | plrmodel = humanoid.Parent | |
| 166 | if plrmodel.Humanoid.Health ~= 0 then | |
| 167 | q(function() | |
| 168 | while Sitting==true do | |
| 169 | me.Character.Humanoid.Sit = true | |
| 170 | me.Character.Torso.Anchored = true | |
| 171 | me.Character.Torso.CFrame = seat.CFrame*CN(0,1.75,0.5) wait() | |
| 172 | end | |
| 173 | end) | |
| 174 | Mouse.Button1Down:connect(function() | |
| 175 | if canfire==true and Sitting==true then | |
| 176 | canfire=false | |
| 177 | Fiyah:Play() | |
| 178 | Shoot() | |
| 179 | wait(0.5) | |
| 180 | canfire=true | |
| 181 | end | |
| 182 | end) | |
| 183 | end) | |
| 184 | h.Deselected:connect(function() Sitting=false canfire=false me.Character.Torso.Anchored=false me.Character.Humanoid.Sit=false end) | |
| 185 | me.Character.Humanoid.Died:connect(function(l) for i,v in pairs(cam:children()) do v:Remove() end end) | |
| 186 | --TigerBloodd |