Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getgenv().flying = true
- getgenv().speed = 2
- local function FLY()
- local T = game:service("Players").LocalPlayer.Character.HumanoidRootPart
- local iyflyspeed = getgenv().speed
- local IYMouse = game:service("Players").LocalPlayer:GetMouse()
- local CONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
- local lCONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
- local SPEED = 0
- local fly = getgenv().flying
- local BG = Instance.new('BodyGyro', T)
- local BV = Instance.new('BodyVelocity', T)
- BG.P = 9e4
- BG.maxTorque = Vector3.new(9e9, 9e9, 9e9)
- BG.cframe = T.CFrame
- BV.velocity = Vector3.new(0, 0, 0)
- BV.maxForce = Vector3.new(9e9, 9e9, 9e9)
- spawn(function()
- repeat wait()
- if CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 or CONTROL.Q + CONTROL.E ~= 0 then
- SPEED = 50
- elseif not (CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 or CONTROL.Q + CONTROL.E ~= 0) and SPEED ~= 0 then
- SPEED = 0
- end
- if (CONTROL.L + CONTROL.R) ~= 0 or (CONTROL.F + CONTROL.B) ~= 0 or (CONTROL.Q + CONTROL.E) ~= 0 then
- BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (CONTROL.F + CONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(CONTROL.L + CONTROL.R, (CONTROL.F + CONTROL.B + CONTROL.Q + CONTROL.E) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
- lCONTROL = {F = CONTROL.F, B = CONTROL.B, L = CONTROL.L, R = CONTROL.R}
- elseif (CONTROL.L + CONTROL.R) == 0 and (CONTROL.F + CONTROL.B) == 0 and (CONTROL.Q + CONTROL.E) == 0 and SPEED ~= 0 then
- BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (lCONTROL.F + lCONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(lCONTROL.L + lCONTROL.R, (lCONTROL.F + lCONTROL.B + CONTROL.Q + CONTROL.E) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
- else
- BV.velocity = Vector3.new(0, 0, 0)
- end
- BG.cframe = workspace.CurrentCamera.CoordinateFrame
- until not getgenv().flying
- CONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
- lCONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
- SPEED = 0
- BG:destroy()
- BV:destroy()
- end)
- IYMouse.KeyDown:connect(function(KEY)
- if KEY:lower() == 'w' then
- if vfly then
- CONTROL.F = vehicleflyspeed
- else
- CONTROL.F = iyflyspeed
- end
- elseif KEY:lower() == 's' then
- if vfly then
- CONTROL.B = - vehicleflyspeed
- else
- CONTROL.B = - iyflyspeed
- end
- elseif KEY:lower() == 'a' then
- if vfly then
- CONTROL.L = - vehicleflyspeed
- else
- CONTROL.L = - iyflyspeed
- end
- elseif KEY:lower() == 'd' then
- if vfly then
- CONTROL.R = vehicleflyspeed
- else
- CONTROL.R = iyflyspeed
- end
- elseif KEY:lower() == 'e' then
- if vfly then
- CONTROL.Q = vehicleflyspeed*2
- else
- CONTROL.Q = iyflyspeed*2
- end
- elseif KEY:lower() == 'q' then
- if vfly then
- CONTROL.E = -vehicleflyspeed*2
- else
- CONTROL.E = -iyflyspeed*2
- end
- end
- end)
- IYMouse.KeyUp:connect(function(KEY)
- if KEY:lower() == 'w' then
- CONTROL.F = 0
- elseif KEY:lower() == 's' then
- CONTROL.B = 0
- elseif KEY:lower() == 'a' then
- CONTROL.L = 0
- elseif KEY:lower() == 'd' then
- CONTROL.R = 0
- elseif KEY:lower() == 'e' then
- CONTROL.Q = 0
- elseif KEY:lower() == 'q' then
- CONTROL.E = 0
- end
- end)
- end
- FLY()
Add Comment
Please, Sign In to add comment