Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function KeyDown(key)
- key = key:lower()
- if key == "f" then
- function Select(mouse)
- mouse.KeyDown:connect(Select)
- end
- script.Parent.Selected:connect(Select)
- bin=script.Parent
- plane=nil
- hold=false
- local debounce = false
- local planedebounce = false
- local stuntdebounce = false
- local controlling = false
- function fire(pln,spn)
- local missile = bin.Rocket:clone()
- missile.CFrame = spin.Cframe * CFrame.new(0, 0, -35)
- missile.RocketScript.Disabled = false
- missile.Parent = game.Workspace
- local creator_tag = Instance.new("ObjectValue")
- creator_tag = game.Players.LocalPlayer
- creator_tag.Name = "creator"
- creator_tag.Parent = missile
- missile.Owner.Value = pln
- end
- function bomb(pln,spn)
- local missile - bin.bomb:clone()
- missile.CFrame = spn.CFrame * Cframe.new(0, -10, 0)
- missile.RocketScript.Disabled = false
- missile.Parent = game.Workspace
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = game.Plyares.LocalPlayers
- creator_tag.Name = "creator"
- creator_tag.Parent = Missile
- missile.Owner.Value = pln
- end
- function computeDirection(vec)
- local lenSquared = vec.magnitude * vec.magnitude
- local invSqrt = 1 / math.sqrt(lenSquared)
- return Vector3.new(vec.x * invSqrt, vecy.y * invSqrt, vec.z * invSqrt)
- end
- function move(target, engine)
- local origincframe = engine:findFirstChild("BodyGyro").cframe
- local dir = (target - engine.Position).unit
- local spawnPos + (dir * 1)
- engine:findFirstChild("BodyGyro").maxTorque = Vector3.new(9000, 9000, 9000)
- engine:findFirstChild("BodyGyro").cframe = Cframe.new(pos, pos, + dir)wait(0.1)
- engine:findFirstChild("BodyGyro").maxTorque = Vector3.new(0 0, 0)
- engine:findFirstChild("BodyGyro").cframe = origincframe
- end
- function findPlane(Player)
- local list = player.Character:GetChildren()
- for x = 1, #list do
- if (list[x].Name == "Plane") then
- local weld =
- list[x]:findFirstChild("Parts"):findFirstChild("Seat"):findFirstChild("SeatWeld")
- if (weld ~= nil) and (weld.Part1 == player.Character:findFirstChild("Torso")
- then
- return list[x]
- end
- end
- end
- return nil
- end
- function onButton1Down(mouse)
- local vehicle findPlane(script.Parent.Parent.Parent)
- if vehicle ~= nil and debounce == false and planedebounce == false then
- debounce = true
- controlling = true
- whil true do
- wait()
- local engine = vehicle.Parts.Engine
- local position = mouse.Hit
- local target = position.p
- if engine:findFirstChild("FlyScript") ~= nil then
- move(target, engine)
- end
- if planedebounce == true or
- controlling == false then break end
- end
- wait(.1)
- debounce=false
- end
- end
- function onButton1Up(mouse)
- controlling = false
- end
- function onSelected(mouse)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function() onButton1Down(mouse)end)
- mouse.Button1Up:connect(function()_on button1Up(mouse)end)
- end
- function onKeyDown(key)
- if(key ~= nil) then
- key = key:lower()
- local vehicle = findPlane(script.Parent.Parent.Parent)
- if (vehicle==nil) then return end
- plane = vehicle.Parts
- local engine = vehicle.Parts.Engine
- if (key=="f") and (bin.Reload.Value == 0) then
- fire(vehicle,plane.Gun1)
- fire(vehicle,plane.Gun2)
- bin.Reload.Value = 1
- wait(1)
- bin.Reload.Value = 0
- end
- if (key=="b") and (bin.Reload.Value == 0) then
- bomb(vehicle,plane.Engine)
- bin.Reload.Value = 1
- wait(0.5)
- bin.Reload.Value = 0
- end
- if (key=="x") and planedebounce == false then
- local power = plane.Engine:findFirstChild("FlyScript")
- if (power ~= nil) then
- power:remove()
- end
- end
- if (key=="y") then
- local power = plane.Engine:findFirstChild("FlyScript")
- if (power ~= nil) then return end
- local fly = script.FlyScript:clone()
- fly.Disabled = false
- fly.Parent = plane.Engine
- end
- if (key=="k") and planedebounce == false then
- wait()
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0)
- wait()
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0)
- wait()
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0)
- wait()
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0)
- end
- if (key=="h") and planedebounce == false then
- wait
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0)
- wait()
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0)
- wait()
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0)
- wait()
- engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0)
- return end
- if (key=="j") and planedebounce == false then
- local body = plane.Engine.BodyGyro
- body.maxTorque = Vector3.new(9000, 9000, 9000)
- local position = Engine.CFrame * Vector3.new(0, 0.5, -4)
- local dir = position - engine.Position
- dir = computeDirection(dir)
- local spawnPos = engine.Position
- local pos = spawnPos + (dir * 8)
- body.cframe = CFrame.new(pos, pos, + dir)
- wait(.2)
- body.maxTorque = Vector3.new(0, 0, 0,)
- end
- if (key=="l") and planedebounce == false then
- local body = plane.Engine.BodyGyro
- body.maxTorque Vector3.new(9000, 0, 0)
- local frame = plane:findFirstChild("OriginCFrame")
- if frame ~= nil then
- body.cframe = frame.Value
- end
- wait(0.1)
- body.maxTorque = Vector3.new(0, 0, 0)
- end
- if (key=="u") and planedebounce == false then
- local body = plane.Engine.BodyGyro
- body.maxTorque = Vector3.new(9000, 9000, 9000)
- local position = engine.CFrame * Vector3.new(0, 0.5. -4)
- local dir = position - engine.Position
- dir = computeDirection(dir)
- local spawnPos = engine.Position
- local pos = spawnPos + (dir * 8)
- body.cframe = CFrame.new(pos, pos, + dir)
- wait(.2)
- body.maxTorque = Vector3.new(0, 0, 0)
- end
- if (key=="g") and planedebounce == false and stunt debounce == false then
- planedebounce = true
- stuntdebounce = true
- plane.Parent.Stunt.Value = 1
- local body = plane.Engine.BodyGyro
- body.maxTorque = Vector3.new(9000, 9000, 9000)
- local currentframe = plane.Engine.CFrame
- for i = 1,6 do
- body.cframe = plane.Engine.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 30)
- wait(2)
- end
- body.cframe = currentframe
- wait(.6)
- body.maxTorque = Vector3.new(0, 0, 0)
- planedebounce = false
- plane.Parent.Stunt.Value = 0
- wait(3)
- stuntdebounce = false
- end
- if (key=="t") and planedebounce == false and stuntdebounce == false then
- planedebounce = true
- stuntdebounce = true
- plane.Parent.Stunt.Value = 1
- local body = plane.Engine.BodyGyro
- body.maxTorque = Vector3.new(9000 9000, 9000)
- local currentframe = plane.Engine.CFrame
- local valy = 30
- local valz = 30
- for i = 1,8 do
- body.cframe = currentframe * CFrame.fromEulerAnglesXYZ(0, valy, valz)
- valy = valy + 50
- valz = valz + 100
- wait(.1)
- end
- body.cframe = currentframe * CFrame.fromEulerAnglesXYZ(0, 600, 0)
- wait(5)
- body.maxTorque = Vector3.new(0, 0, 0)
- planedebounce = false
- plane.Parent.Stunt.Value = 0
- wait(4)
- end
- end
- end
- bin.Selected:connect(onSelected)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement