Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function IntGUI()
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local localroot = character:WaitForChild("HumanoidRootPart")
- local playergui = player:WaitForChild("PlayerGui")
- local humanoid = character:WaitForChild("Humanoid")
- -- Main Frame and GUI
- local GUI = Instance.new("ScreenGui")
- GUI.Parent = playergui
- GUI.Name = "Main GUI"
- local mainFrame = Instance.new("Frame")
- mainFrame.Size = UDim2.new(0, 150, 0, 150)
- mainFrame.Parent = GUI
- mainFrame.Position = UDim2.new(0, 500, 0, 0)
- mainFrame.BackgroundColor3 = Color3.new(1, 1, 1)
- -- Title
- local title = Instance.new("TextLabel")
- title.Parent = mainFrame
- title.Name = "Title"
- title.Text = "Fly Vehicle GUI v1"
- title.Size = UDim2.new(0, 150, 0, 10)
- -- Close/Open Button
- local Close = Instance.new("TextButton")
- Close.Size = UDim2.new(0, 80, 0, 50)
- Close.BackgroundColor3 = Color3.new(1, 1, 1)
- Close.Position = UDim2.new(0, 0, 0, 150)
- Close.Name = "CloseButton"
- Close.Parent = GUI
- Close.Text = "Close/Open"
- -- Fucntion when Clicked
- Close.MouseButton1Click:Connect(function()
- if mainFrame.Visible then
- mainFrame.Visible = false
- elseif not mainFrame.Visible then
- mainFrame.Visible = true
- end
- end)
- local Flybutton = Instance.new("TextButton")
- Flybutton.Parent = mainFrame
- Flybutton.Size = UDim2.new(0, 150, 0, 30)
- Flybutton.Position = UDim2.new(0, 0, 0, 10)
- Flybutton.Name = "Fly Button"
- Flybutton.Text = "Click me To Fly"
- -- Speed InPut Text
- local Speed = Instance.new("TextBox")
- Speed.Size = UDim2.new(0, 150, 0, 20)
- Speed.Position = UDim2.new(0, 0, 0, 150)
- Speed.Name = "Speed"
- Speed.Text = "Put you Speed Value of Fly here"
- Speed.Parent = mainFrame
- -- Stop flying Function
- local StopFly = Instance.new("TextButton")
- StopFly.Size = UDim2.new(0, 150, 0, 20)
- StopFly.Position = UDim2.new(0, 0, 0, 80)
- StopFly.Name = "Stop Fly"
- StopFly.Parent = mainFrame
- StopFly.Text = "Stop Fly"
- -- Function when Clicked
- Flybutton.MouseButton1Click:Connect(function()
- if Flybutton.Text ~= "Now Flying" then
- Flybutton.Text = "Now Flying"
- local bg = Instance.new("BodyGyro", localroot)
- local bv = Instance.new("BodyVelocity", localroot)
- bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
- bg.D = 5000
- bg.P = 50000
- bg.CFrame = game.Workspace.CurrentCamera.CFrame
- if Flybutton.Text == "Now Flying" then
- if not mainFrame:FindFirstChild("Foward Fly") then
- local foward = Instance.new("TextButton")
- foward.Size = UDim2.new(0,150, 0, 20)
- foward.Position = UDim2.new(0, 0, 0, 40)
- foward.Name = "Foward Fly"
- foward.Text = "Foward Fly"
- foward.Parent = mainFrame
- local backward = Instance.new("TextButton")
- backward.Parent = mainFrame
- backward.Name = "Backward"
- backward.Size = UDim2.new(0, 150, 0, 20)
- backward.Position = UDim2.new(0, 0, 0, 60)
- backward.Text = "Backward"
- foward.MouseButton1Click:Connect(function()
- localroot.Anchored = false
- localroot:FindFirstChildOfClass("BodyVelocity"):Destroy()
- localroot:FindFirstChildOfClass("BodyGyro"):Destroy()
- local bg = Instance.new("BodyGyro", localroot)
- local bv = Instance.new("BodyVelocity", localroot)
- bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
- bg.D = 5000
- bg.P = 50000
- bg.CFrame = game.Workspace.CurrentCamera.CFrame
- bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- bv.P = 5000
- bv.Velocity = game.Workspace.CurrentCamera.CFrame.LookVector * tonumber(Speed.Text)
- wait(3)
- bv.Velocity = Vector3.new()
- end)
- backward.MouseButton1Click:Connect(function()
- localroot.Anchored = false
- localroot:FindFirstChildOfClass("BodyVelocity"):Destroy()
- localroot:FindFirstChildOfClass("BodyGyro"):Destroy()
- local bg = Instance.new("BodyGyro", localroot)
- local bv = Instance.new("BodyVelocity", localroot)
- bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
- bg.D = 5000
- bg.P = 50000
- bg.CFrame = game.Workspace.CurrentCamera.CFrame
- bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- bv.P = 5000
- bv.Velocity = game.Workspace.CurrentCamera.CFrame.LookVector * tonumber(-Speed.Text)
- wait(3)
- bv.Velocity = Vector3.new()
- end)
- StopFly.MouseButton1Click:Connect(function()
- humanoid.Health = 0
- Flybutton.Text = "Stopped Fly Click Again to Fly"
- foward:Destroy()
- backward:Destroy()
- end)
- end
- end
- end
- end)
- end
- IntGUI()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement