Advertisement
GETFREEROBUX

Fly Car script

Feb 10th, 2022
8,336
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.03 KB | None | 0 0
  1. -- Fly Car (Prison Life)
  2.  
  3. -- Instances:
  4.  
  5. local ScreenGui = Instance.new("ScreenGui")
  6. local Frame = Instance.new("Frame")
  7. local Fly = Instance.new("TextButton")
  8. local Text = Instance.new("TextLabel")
  9. local TextLabel = Instance.new("TextLabel")
  10. local TextLabel_2 = Instance.new("TextLabel")
  11.  
  12. --Properties:
  13.  
  14. ScreenGui.Parent = game.CoreGui
  15. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  16.  
  17. Frame.Parent = ScreenGui
  18. Frame.BackgroundColor3 = Color3.fromRGB(0, 154, 0)
  19. Frame.Position = UDim2.new(0.734463215, 0, 0.204301089, 0)
  20. Frame.Size = UDim2.new(0, 218, 0, 247)
  21. Frame.Active = true
  22. Frame.Draggable = true
  23.  
  24. Fly.Name = "Fly"
  25. Fly.Parent = Frame
  26. Fly.BackgroundColor3 = Color3.fromRGB(0, 179, 179)
  27. Fly.BorderSizePixel = 0
  28. Fly.Position = UDim2.new(0.0871559605, 0, 0.542510092, 0)
  29. Fly.Size = UDim2.new(0, 179, 0, 50)
  30. Fly.Font = Enum.Font.SourceSans
  31. Fly.Text = "Press to execute fly car"
  32. Fly.TextColor3 = Color3.fromRGB(0, 0, 0)
  33. Fly.TextSize = 14.000
  34. Fly.MouseButton1Down:connect(function()
  35.     local hint = Instance.new("Hint",game.Players.LocalPlayer.PlayerGui)
  36.     hint.Text = "Press Z To Toggle"
  37.     hint.Name = game.JobId
  38.     repeat wait()
  39.     until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  40.     local mouse = game.Players.LocalPlayer:GetMouse()
  41.     repeat wait() until mouse
  42.     local plr = game.Players.LocalPlayer
  43.     local torso = plr.Character.Torso
  44.     local flying = true
  45.     local deb = true
  46.     local ctrl = {f = 0, b = 0, l = 0, r = 0}
  47.     local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  48.     local maxspeed = 500
  49.     local speed = 0
  50.  
  51.     function Fly()
  52.         local bg = Instance.new("BodyGyro", torso)
  53.         bg.P = 9e4
  54.         bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  55.         bg.cframe = torso.CFrame
  56.         local bv = Instance.new("BodyVelocity", torso)
  57.         bv.velocity = Vector3.new(0,0.1,0)
  58.         bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  59.         repeat wait()
  60.             plr.Character.Humanoid.PlatformStand = false
  61.             if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  62.                 speed = speed+125.0+(speed/maxspeed)
  63.                 if speed > maxspeed then
  64.                     speed = maxspeed
  65.                 end
  66.             elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  67.                 speed = speed-250
  68.                 if speed < 0 then
  69.                     speed = 0
  70.                 end
  71.             end
  72.             if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  73.                 bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  74.                 lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  75.             elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  76.                 bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  77.             else
  78.                 bv.velocity = Vector3.new(0,0.1,0)
  79.             end
  80.             bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  81.         until not flying
  82.         ctrl = {f = 0, b = 0, l = 0, r = 0}
  83.         lastctrl = {f = 0, b = 0, l = 0, r = 0}
  84.         speed = 0
  85.         bg:Destroy()
  86.         bv:Destroy()
  87.         plr.Character.Humanoid.PlatformStand = false
  88.     end
  89.     mouse.KeyDown:connect(function(key)
  90.         if key:lower() == "z" then
  91.             if flying then flying = false
  92.             else
  93.                 flying = true
  94.                 Fly()
  95.             end
  96.         elseif key:lower() == "w" then
  97.             ctrl.f = 1
  98.         elseif key:lower() == "s" then
  99.             ctrl.b = -1
  100.         elseif key:lower() == "a" then
  101.             ctrl.l = -1
  102.         elseif key:lower() == "d" then
  103.             ctrl.r = 1
  104.         end
  105.     end)
  106.     mouse.KeyUp:connect(function(key)
  107.         if key:lower() == "w" then
  108.             ctrl.f = 0
  109.         elseif key:lower() == "s" then
  110.             ctrl.b = 0
  111.         elseif key:lower() == "a" then
  112.             ctrl.l = 0
  113.         elseif key:lower() == "d" then
  114.             ctrl.r = 0
  115.         end
  116.         wait(5)
  117.         hint:Destroy()
  118.     end)
  119.     Fly()
  120. end)
  121.  
  122. Text.Name = "Text"
  123. Text.Parent = Frame
  124. Text.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  125. Text.Size = UDim2.new(0, 218, 0, 32)
  126. Text.Font = Enum.Font.SourceSans
  127. Text.Text = "Prison Life Fly Car Script"
  128. Text.TextColor3 = Color3.fromRGB(0, 0, 0)
  129. Text.TextSize = 14.000
  130.  
  131. TextLabel.Parent = Frame
  132. TextLabel.BackgroundColor3 = Color3.fromRGB(0, 154, 0)
  133. TextLabel.BorderSizePixel = 0
  134. TextLabel.Position = UDim2.new(0.087155968, 0, 0.182186231, 0)
  135. TextLabel.Size = UDim2.new(0, 174, 0, 89)
  136. TextLabel.Font = Enum.Font.SourceSans
  137. TextLabel.Text = "TO UNFLY PRESS 'Z' TO FLY PRESS 'Z'"
  138. TextLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
  139. TextLabel.TextSize = 14.000
  140.  
  141. TextLabel_2.Parent = Frame
  142. TextLabel_2.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
  143. TextLabel_2.Position = UDim2.new(0, 0, 1, 0)
  144. TextLabel_2.Size = UDim2.new(0, 218, 0, 50)
  145. TextLabel_2.Font = Enum.Font.SourceSans
  146. TextLabel_2.Text = "Credits: Birthday"
  147. TextLabel_2.TextColor3 = Color3.fromRGB(0, 0, 0)
  148. TextLabel_2.TextSize = 14.000
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement