hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 15 Nov 2011 08:11 AM |
It's a turret.
local enablesome = "off" local extence = 0 local bin = script.Parent.Flash local bin2 = script.Parent.Facer local Fire = bin.Fire local Reload = bin.Reload
function aim(target) local dir = (target.Position - bin2.Position).unit local spawnPos = bin2.Position local pos = spawnPos + (dir * 1) bin2:findFirstChild("BodyGyro").cframe = CFrame.new(pos, pos + dir) end
function run(onoroff, vaktarget) if onoroff == "on" then --start firing loop :3 if extence == 0 then extence = 1 script.Parent.Base.Startup:Play() maxLight = 100 --BEGIN AMAZING MOVEMENT IN 2 SECODS! script.Parent.Facer.BodyGyro.maxTorque = Vector3.new(0,9000,9000) for i=1,20 do allparts1 = script.Parent:GetChildren() for i=1,#allparts1 do if allparts1[i].ClassName == "Part" or allparts1[i].ClassName == "WedgePart" then if allparts1[i].ClassName == "WedgePart" and allparts1[i].Name == "Down" then allparts1[i].CFrame = allparts1[i].CFrame * CFrame.new(Vector3.new(0,-0.06,0)) else allparts1[i].CFrame = allparts1[i].CFrame * CFrame.new(Vector3.new(0,0.06,0)) end end end wait(0.1) end script.Parent.Base.Startup:Stop() --BEGIN GUN EXTEND AND LASER ON! for i=1,20 do script.Parent.Handle.CFrame = script.Parent.Handle.CFrame * CFrame.new(Vector3.new(0,0,-0.05)) maxLight = maxLight - 5 script.Parent.Laser.Transparency = math.random(maxLight,100) / 100 wait(0.05) end script.Parent.Laser.Transparency = 0 --WELD, THENUNANCHOR THE PARTS, THEN LET THE MECHANISM MOVE ITSELF! parts = script.Parent:GetChildren() flashparts = script.Parent.MoreFlash:GetChildren() for i=1,#parts do if parts[i].ClassName == "Part" then weld = Instance.new("Weld") weld.Part0 = parts[i] weld.Part1 = script.Parent.Base weld.C0 = parts[i].CFrame:inverse() weld.C1 = script.Parent.Base.CFrame:inverse() weld.Parent = script.Parent.Base end end for i=1,#flashparts do weld = Instance.new("Weld") weld.Part0 = flashparts[i] weld.Part1 = script.Parent.Base weld.C0 = flashparts[i].CFrame:inverse() weld.C1 = script.Parent.Base.CFrame:inverse() weld.Parent = script.Parent.Base end for i=1, #parts do if parts[i].ClassName == "Part" then parts[i].Anchored = false parts[i].Velocity = Vector3.new(0,0,0) parts[i].RotVelocity = Vector3.new(0,0,0) end end for i=1, #flashparts do flashparts[i].Anchored = false flashparts[i].Velocity = Vector3.new(0,0,0) flashparts[i].RotVelocity = Vector3.new(0,0,0) end end --SPIN DAT GUN, DAMAGE DAT MAN! for i=1,20 do Flashes = script.Parent.MoreFlash:GetChildren() for i=1,#Flashes do FlashesNew = Flashes[i]:GetChildren() for i=1,#FlashesNew do if FlashesNew[i].ClassName == "BlockMesh" then FlashesNew[i].Scale = Vector3.new(1,1,1) end end end bin.Mesh.Scale = Vector3.new(0,0,0) Fire.Pitch = math.random(100,110)/100 Fire:Play() aim(vaktarget) wait(0.05) for i=1,#Flashes do FlashesNew = Flashes[i]:GetChildren() for i=1,#FlashesNew do if FlashesNew[i].ClassName == "BlockMesh" then FlashesNew[i].Scale = Vector3.new(0,0,0) end end end bin.Mesh.Scale = Vector3.new(0,0,0) if vaktarget.Parent ~= nil then vaktarget.Parent.Humanoid.Health = vaktarget.Parent.Humanoid.Health - 6 end wait(0.05) end else if extence == 1 then extence = 0 --BEGIN GUN CONTRACT AND LASER OFF! ----------------------------------------------------------------------------------------------------------------------------------- for i=1,70 do aim(game.Lighting.f) wait() end basecollect = script.Parent.Base:GetChildren() for i=1, #parts do if parts[i].ClassName == "Part" then parts[i].Anchored = true parts[i].Velocity = Vector3.new(0,0,0) parts[i].RotVelocity = Vector3.new(0,0,0) end end for i=1,#basecollect do if basecollect[i].ClassName == "Weld" then basecollect[i]:Remove() end end for i=1,#Flashes do FlashesCollect = Flashes[i]:GetChildren() for i=1,#FlashesCollect do if FlashesCollect[i].ClassName == "Weld" then FlashesCollect[i]:Remove() end end end for i=1, #flashparts do flashparts[i].Anchored = true flashparts[i].Velocity = Vector3.new(0,0,0) flashparts[i].RotVelocity = Vector3.new(0,0,0) end for i=1,#Flashes do FlashesNew = Flashes[i]:GetChildren() for i=1,#FlashesNew do if FlashesNew[i].ClassName == "BlockMesh" then FlashesNew[i].Scale = Vector3.new(0,0,0) end end end for i=1,20 do script.Parent.Handle.CFrame = script.Parent.Handle.CFrame * CFrame.new(Vector3.new(0,0,0.05)) maxLight = maxLight + 5 script.Parent.Laser.Transparency = math.random(maxLight,100) / 100 wait(0.01) end script.Parent.Laser.Transparency = 1 --BEGIN DOWNWARDS ANIMATION! script.Parent.Base.Cooldown:Play() for i=1,20 do allparts1 = script.Parent:GetChildren() for i=1,#allparts1 do if allparts1[i].ClassName == "Part" or allparts1[i].ClassName == "WedgePart" then if allparts1[i].ClassName == "WedgePart" and allparts1[i].Name == "Down" then allparts1[i].CFrame = allparts1[i].CFrame * CFrame.new(Vector3.new(0,0.06,0)) else allparts1[i].CFrame = allparts1[i].CFrame * CFrame.new(Vector3.new(0,-0.06,0)) end end end wait(0.1) end end --stop firing loop 3: end end
function findNearestTorso(pos) local list = game.Workspace:children() local torso = nil local dist = 50 local temp = nil local human = nil local temp2 = nil for x = 1, #list do temp2 = list[x] if (temp2.className == "Model") and (temp2 ~= script.Parent) then temp = temp2:findFirstChild("Torso") human = temp2:findFirstChild("Humanoid") if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then if (temp.Position - pos).magnitude < dist then torso = temp dist = (temp.Position - pos).magnitude end end end end return torso end
while true do wait(1) local target = findNearestTorso(script.Parent.Base.Position) if target ~= nil then enablesome = "on" run(enablesome, target) aim(target) else enablesome = "off" run(enablesome, target) end end
|
|
|
| Report Abuse |
|
BCGames
|
  |
| Joined: 30 Dec 2010 |
| Total Posts: 8182 |
|
| |
ghpmrsjl
|
  |
| Joined: 06 Oct 2011 |
| Total Posts: 5817 |
|
|
| 15 Nov 2011 08:12 AM |
| Or BCGames can make his own. |
|
|
| Report Abuse |
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 15 Nov 2011 08:13 AM |
Or, you can learn from my own creation. You: <_> |
|
|
| Report Abuse |
|
BCGames
|
  |
| Joined: 30 Dec 2010 |
| Total Posts: 8182 |
|
|
| 15 Nov 2011 08:13 AM |
@Hunt
It's not yours. Free modeled. You wouldn't make comments if you made it. It's just redundant. |
|
|
| Report Abuse |
|
| |
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 15 Nov 2011 08:14 AM |
You can find a video on how it works on my YouTube channel. (hunte922) Or just search it, it's called "Trip Turret Beta 002" |
|
|
| Report Abuse |
|