Advertisement
SigmaBoy456

Vehicle fly GUI v1 by me

Sep 20th, 2024
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.73 KB | None | 0 0
  1. local function IntGUI()
  2. local player = game.Players.LocalPlayer
  3. local character = player.Character or player.CharacterAdded:Wait()
  4. local localroot = character:WaitForChild("HumanoidRootPart")
  5. local playergui = player:WaitForChild("PlayerGui")
  6. local humanoid = character:WaitForChild("Humanoid")
  7.  
  8. -- Main Frame and GUI
  9. local GUI = Instance.new("ScreenGui")
  10. GUI.Parent = playergui
  11. GUI.Name = "Main GUI"
  12. local mainFrame = Instance.new("Frame")
  13. mainFrame.Size = UDim2.new(0, 150, 0, 150)
  14. mainFrame.Parent = GUI
  15. mainFrame.Position = UDim2.new(0, 500, 0, 0)
  16. mainFrame.BackgroundColor3 = Color3.new(1, 1, 1)
  17. -- Title
  18. local title = Instance.new("TextLabel")
  19. title.Parent = mainFrame
  20. title.Name = "Title"
  21. title.Text = "Fly Vehicle GUI v1"
  22. title.Size = UDim2.new(0, 150, 0, 10)
  23. -- Close/Open Button
  24. local Close = Instance.new("TextButton")
  25. Close.Size = UDim2.new(0, 80, 0, 50)
  26. Close.BackgroundColor3 = Color3.new(1, 1, 1)
  27. Close.Position = UDim2.new(0, 0, 0, 150)
  28. Close.Name = "CloseButton"
  29. Close.Parent = GUI
  30. Close.Text = "Close/Open"
  31. -- Fucntion when Clicked
  32. Close.MouseButton1Click:Connect(function()
  33. if mainFrame.Visible then
  34. mainFrame.Visible = false
  35. elseif not mainFrame.Visible then
  36. mainFrame.Visible = true
  37. end
  38. end)
  39.  
  40. local Flybutton = Instance.new("TextButton")
  41. Flybutton.Parent = mainFrame
  42. Flybutton.Size = UDim2.new(0, 150, 0, 30)
  43. Flybutton.Position = UDim2.new(0, 0, 0, 10)
  44. Flybutton.Name = "Fly Button"
  45. Flybutton.Text = "Click me To Fly"
  46. -- Speed InPut Text
  47. local Speed = Instance.new("TextBox")
  48. Speed.Size = UDim2.new(0, 150, 0, 20)
  49. Speed.Position = UDim2.new(0, 0, 0, 150)
  50. Speed.Name = "Speed"
  51. Speed.Text = "Put you Speed Value of Fly here"
  52. Speed.Parent = mainFrame
  53. -- Stop flying Function
  54. local StopFly = Instance.new("TextButton")
  55. StopFly.Size = UDim2.new(0, 150, 0, 20)
  56. StopFly.Position = UDim2.new(0, 0, 0, 80)
  57. StopFly.Name = "Stop Fly"
  58. StopFly.Parent = mainFrame
  59. StopFly.Text = "Stop Fly"
  60. -- Function when Clicked
  61. Flybutton.MouseButton1Click:Connect(function()
  62. if Flybutton.Text ~= "Now Flying" then
  63. Flybutton.Text = "Now Flying"
  64. local bg = Instance.new("BodyGyro", localroot)
  65. local bv = Instance.new("BodyVelocity", localroot)
  66. bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  67. bg.D = 5000
  68. bg.P = 50000
  69. bg.CFrame = game.Workspace.CurrentCamera.CFrame
  70. if Flybutton.Text == "Now Flying" then
  71. if not mainFrame:FindFirstChild("Foward Fly") then
  72. local foward = Instance.new("TextButton")
  73. foward.Size = UDim2.new(0,150, 0, 20)
  74. foward.Position = UDim2.new(0, 0, 0, 40)
  75. foward.Name = "Foward Fly"
  76. foward.Text = "Foward Fly"
  77. foward.Parent = mainFrame
  78. local backward = Instance.new("TextButton")
  79. backward.Parent = mainFrame
  80. backward.Name = "Backward"
  81. backward.Size = UDim2.new(0, 150, 0, 20)
  82. backward.Position = UDim2.new(0, 0, 0, 60)
  83. backward.Text = "Backward"
  84. foward.MouseButton1Click:Connect(function()
  85. localroot.Anchored = false
  86. localroot:FindFirstChildOfClass("BodyVelocity"):Destroy()
  87. localroot:FindFirstChildOfClass("BodyGyro"):Destroy()
  88. local bg = Instance.new("BodyGyro", localroot)
  89. local bv = Instance.new("BodyVelocity", localroot)
  90. bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  91. bg.D = 5000
  92. bg.P = 50000
  93. bg.CFrame = game.Workspace.CurrentCamera.CFrame
  94. bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  95. bv.P = 5000
  96. bv.Velocity = game.Workspace.CurrentCamera.CFrame.LookVector * tonumber(Speed.Text)
  97. wait(3)
  98. bv.Velocity = Vector3.new()
  99. end)
  100. backward.MouseButton1Click:Connect(function()
  101. localroot.Anchored = false
  102. localroot:FindFirstChildOfClass("BodyVelocity"):Destroy()
  103. localroot:FindFirstChildOfClass("BodyGyro"):Destroy()
  104. local bg = Instance.new("BodyGyro", localroot)
  105. local bv = Instance.new("BodyVelocity", localroot)
  106. bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  107. bg.D = 5000
  108. bg.P = 50000
  109. bg.CFrame = game.Workspace.CurrentCamera.CFrame
  110. bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  111. bv.P = 5000
  112. bv.Velocity = game.Workspace.CurrentCamera.CFrame.LookVector * tonumber(-Speed.Text)
  113. wait(3)
  114. bv.Velocity = Vector3.new()
  115. end)
  116. StopFly.MouseButton1Click:Connect(function()
  117. humanoid.Health = 0
  118. Flybutton.Text = "Stopped Fly Click Again to Fly"
  119. foward:Destroy()
  120. backward:Destroy()
  121. end)
  122. end
  123. end
  124. end
  125. end)
  126. end
  127.  
  128.  
  129. IntGUI()
  130.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement