From c7d8c026b6dcc6b7277ac5cf2331c1b0abfc906e Mon Sep 17 00:00:00 2001 From: teagenf01 Date: Sun, 23 Feb 2025 10:37:39 -0500 Subject: [PATCH] Create fly --- fly | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 fly diff --git a/fly b/fly new file mode 100644 index 000000000..a131435ac --- /dev/null +++ b/fly @@ -0,0 +1,35 @@ +local UserInputService = game:GetService("UserInputService") +local Players = game:GetService("Players") + +local player = Players.LocalPlayer +local character = player.Character or player.CharacterAdded:Wait() +local humanoidRootPart = character:WaitForChild("HumanoidRootPart") + +local flying = false +local flightForce = nil + +-- Function to enable/disable flight +local function toggleFlight() + if flying then + -- Disable Flight + if flightForce then + flightForce:Destroy() + end + flying = false + else + -- Enable Flight + flightForce = Instance.new("BodyVelocity") + flightForce.Velocity = Vector3.new(0, 50, 0) -- Adjust height speed + flightForce.MaxForce = Vector3.new(math.huge, math.huge, math.huge) + flightForce.Parent = humanoidRootPart + flying = true + end +end + +-- Detect Key Press +UserInputService.InputBegan:Connect(function(input, processed) + if processed then return end + if input.KeyCode == Enum.KeyCode.F then + toggleFlight() + end +end)