Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local power = 20
- wait(2)
- local bin = script.Parent
- local fly = false
- local origval = bin.Origin.Value
- local value = origval.Inside
- local entry = origval.Entry
- local base = entry.Base
- local airborne = false
- local intsounds = value.Parts.Console.CenterThing
- introtor = intsounds.Rotor
- extrotor = base.Rotor
- function onButton1Down(mouse)
- if (value.Flying.Value) then
- ----
- if base:findFirstChild("Spin") then
- local fba = base:findFirstChild("Spin")
- end
- if base:findFirstChild("FlightPos") then
- local bpos = base:findFirstChild("FlightPos")
- end
- if base:findFirstChild("FlightGyro") then
- local gyro = base:findFirstChild("FlightGyro")
- end
- fly = true
- while (fly) and (value.Flying.Value) do
- local power = value.MovSpeed.Value
- ----
- if (power >= 1) then
- fba.angularvelocity = Vector3.new(0,1,0)
- end
- if (power == 0) then
- fba.angularvelocity = Vector3.new(0,0,0)
- end
- if (power >= 20) then
- fba.angularvelocity = Vector3.new(0,2,0)
- end
- if (power >= 40) then
- fba.angularvelocity = Vector3.new(0,3,0)
- end
- if (power >= 50) then
- fba.angularvelocity = Vector3.new(0,4,0)
- end
- if (power >= 100) then
- fba.angularvelocity = Vector3.new(0,5,0)
- end
- if (value.EntryFreak.Value) then
- gyro.maxTorque = Vector3.new(0,0,0)
- fba.angularvelocity = Vector3.new(math.random(0,5),math.random(0,5),math.random(0,5))
- else
- gyro.maxTorque = Vector3.new(200,0,200)
- end
- ----
- pos = mouse.Hit.p
- bpos.position = base.Position + (pos-base.Position).unit * power
- wait()
- end
- fly = false
- end
- end
- function onMove(mouse)
- pos = mouse.Hit.p
- end
- function onButton1Up(mouse)
- fly = false
- end
- function onSelected(mouse)
- print("select")
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- mouse.Button1Up:connect(function() onButton1Up(mouse) end)
- mouse.Move:connect(function() onMove(mouse) end)
- mouse.KeyDown:connect(onKeyDown)
- end
- --[[function onDeselected(mouse)
- print("deselect")
- end--]]
- --[[value.Flying.Changed:connect(function()
- if airborne == true then
- airborne = false
- bpos:Remove()
- end
- end)
- --]]
- function startflight()
- if (value.Working.Value) or (value.Timing.Value) or (value.Fused.Value) or (value.Fule.Value == 0) then return end
- value.Flying.Value = true
- introtor:play()
- extrotor:play()
- fba = Instance.new("BodyAngularVelocity")
- fba.Name = "Spin"
- fba.Parent = base
- fba.angularvelocity = Vector3.new(0,1,0)
- fba.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
- ----
- bpos = Instance.new("BodyPosition")
- bpos.maxForce = Vector3.new(math.huge,math.huge,math.huge)
- bpos.Parent = base
- bpos.position = base.Position
- bpos.Name = "FlightPos"
- --
- gyro = Instance.new("BodyGyro")
- gyro.maxTorque = Vector3.new(200,0,200)
- gyro.D = 0
- gyro.P = 200
- gyro.Parent = base
- gyro.Name = "FlightGyro"
- --
- end
- function endflight()
- value.Flying.Value = false
- introtor:stop()
- extrotor:stop()
- --
- for i=1,3 do
- wait(0.000001)
- if base:findFirstChild("Spin") then
- base:findFirstChild("Spin"):Remove()
- end
- if base:findFirstChild("FlightPos") then
- base:findFirstChild("FlightPos"):Remove()
- end
- if base:findFirstChild("FlightGyro") then
- base:findFirstChild("FlightGyro"):Remove()
- end
- end
- end
- function onKeyDown(key)
- if key == "z" then
- if (value.Flying.Value) then
- endflight()
- else
- startflight()
- end
- end
- if key == "q" then
- if (value.MovSpeed.Value > 0) then
- value.MovSpeed.Value = value.SpeedButton.Value - 1
- end
- end
- if key == "e" then
- if (value.MovSpeed.Value < 50) then
- value.MovSpeed.Value = value.SpeedButton.Value + 1
- end
- end
- end
- bin.Selected:connect(onSelected)
- bin.Deselected:Connect(onDeselected)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement