Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local setting = {
- time = getgenv().setting_stopflytime or 3
- }
- local player = game.Players.LocalPlayer
- local character = player.Character
- local localroot = character:WaitForChild("HumanoidRootPart")
- local function getVER()
- for _, v in pairs(localroot:GetDescendants()) do
- if v:IsA("BodyVelocity") then
- return v
- end
- end
- end
- local function getGY()
- for _, v in pairs(localroot:GetDescendants()) do
- if v:IsA("BodyGyro") then
- return v
- end
- end
- end
- local function stopFLY()
- if getVER() and getGY() then
- getVER():Destroy()
- getGY():Destroy()
- end
- end
- local Cam = workspace.CurrentCamera
- -- Update GUI
- if game.CoreGui:FindFirstChild("Vehicle GUI") then
- game.CoreGui:FindFirstChild("Vehicle GUI"):Destroy()
- end
- -- Update Player
- game.Players.LocalPlayer.CharacterAdded:Connect(function(char)
- character = char
- localroot = character:WaitForChild("HumanoidRootPart")
- end)
- local GUI = Instance.new("ScreenGui", game.CoreGui)
- GUI.Name = "Vehicle GUI"
- local mainF = Instance.new("Frame", GUI)
- mainF.Size = UDim2.new(0, 100, 0, 100)
- mainF.Name = "my Frame"
- mainF.Position = UDim2.new(0, 30, 0, 0)
- mainF.BackgroundColor3 = Color3.new(1, 1, 1)
- mainF.Active = true
- mainF.Draggable = true
- local title = Instance.new("TextLabel", mainF)
- title.Name = "my Title"
- title.Size = UDim2.new(0, 100, 0, 20)
- title.Position = UDim2.new(0, 0, 0, 0)
- title.BackgroundColor3 = Color3.new(1, 1, 1)
- title.Text = "Vehicle Fly v2"
- title.TextScaled = true
- title.TextWrapped = true
- local flyButton = Instance.new("TextButton", mainF)
- flyButton.Size = UDim2.new(0, 100, 0, 30)
- flyButton.Position = UDim2.new(0, 0, 0, 20)
- flyButton.Name = "My Button to fly"
- flyButton.BackgroundColor3 = Color3.fromRGB(31, 255, 0)
- flyButton.Text = "Fly foward"
- flyButton.TextScaled = true
- flyButton.TextWrapped = true
- local speed_INPUT = Instance.new("TextBox", mainF)
- speed_INPUT.Size = UDim2.new(0, 100, 0, 20)
- speed_INPUT.Position = UDim2.new(0, 0, 0, 50)
- speed_INPUT.BackgroundColor3 = Color3.new(1, 1, 1)
- speed_INPUT.Name = "Speed Input"
- speed_INPUT.Text = "Input you Fly Speed here"
- speed_INPUT.TextScaled = true
- speed_INPUT.TextWrapped = true
- -- setup BodyVelocity and BodyGyro
- local ver = Instance.new("BodyVelocity", localroot)
- local bg = Instance.new("BodyGyro", localroot)
- -- Event
- flyButton.MouseButton1Click:Connect(function()
- if localroot then
- if not localroot:FindFirstChildOfClass("BodyVelocity") and not localroot:FindFirstChildOfClass("BodyGyro") then
- ver = Instance.new("BodyVelocity", localroot)
- bg = Instance.new("BodyGyro", localroot)
- end
- bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
- bg.D = 5000
- bg.P = 5000
- bg.CFrame = Cam.CFrame
- ver.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- ver.P = 50000
- ver.Velocity = Cam.CFrame.LookVector * tonumber(speed_INPUT.Text)
- wait(setting.time)
- ver.P = 0
- ver.Velocity = Vector3.new()
- end
- end)
- local stopFly = Instance.new("TextButton", mainF)
- stopFly.Size = UDim2.new(0, 100, 0, 20)
- stopFly.Position = UDim2.new(0, 0, 0, 100)
- stopFly.Name = "Stop fly funny"
- stopFly.BackgroundColor3 = Color3.fromRGB(255, 17, 0)
- stopFly.Text = "Stop Fly"
- stopFly.TextScaled = true
- stopFly.TextWrapped = true
- -- Event
- stopFly.MouseButton1Click:Connect(function()
- if localroot:FindFirstChildOfClass("BodyVelocity") and localroot:FindFirstChildOfClass("BodyGyro") then
- repeat
- stopFLY()
- until localroot:FindFirstChildOfClass("BodyVelocity") == nil and localroot:FindFirstChildOfClass("BodGyro") == nil
- end
- end)
- local backward = Instance.new("TextButton", mainF)
- backward.Size = UDim2.new(0, 100, 0, 20)
- backward.Position = UDim2.new(0, 0, 0, 70)
- backward.BackgroundColor3 = Color3.new(1, 1, 1)
- backward.Name = "Backward"
- backward.Text = "Fly Backward"
- backward.TextScaled = true
- backward.TextWrapped = true
- -- Event
- backward.MouseButton1Click:Connect(function()
- if localroot then
- if not localroot:FindFirstChildOfClass("BodyVelocity") and not localroot:FindFirstChildOfClass("BodyGyro") then
- ver = Instance.new("BodyVelocity", localroot)
- bg = Instance.new("BodyGyro", localroot)
- end
- bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
- bg.D = 5000
- bg.P = 50000
- bg.CFrame = Cam.CFrame
- ver.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- ver.P = 50000
- ver.Velocity = Cam.CFrame.LookVector * tonumber(-speed_INPUT.Text)
- wait(setting.time)
- ver.Velocity = Vector3.new()
- end
- end)
- local close = Instance.new("TextButton", GUI)
- close.Size = UDim2.new(0, 100, 0, 50)
- close.Position = UDim2.new(0, 0, 0, 200)
- close.Name = "Close the GUI"
- close.BackgroundColor3 = Color3.new(1, 1, 1)
- close.Text = "Close GUI"
- close.TextScaled = true
- close.TextWrapped = true
- -- Event
- close.MouseButton1Click:Connect(function()
- if mainF.Visible then
- mainF.Visible = false
- close.Text = "Open GUI"
- elseif not mainF.Visible then
- mainF.Visible = true
- close.Text = "Close GUI"
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement