local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer -- SETTINGS local GLIDE_SPEED = 50 local FALL_SPEED = -6 local TURN_POWER = 3000 local GLIDE_ANIM_ID = "rbxassetid://90686495729962" -- VISUAL local LEAN_ANGLE = math.rad(-25) local GLIDE_HIPHEIGHT = 1.2 -- Runtime local char, humanoid, root local gliding = false local bodyVel, bodyGyro local glideTrack local defaultHipHeight -------------------------------------------------- -- GLIDE FUNCTIONS -------------------------------------------------- local function stopGlide() gliding = false if glideTrack then glideTrack:Stop() end if bodyVel then bodyVel:Destroy() bodyVel = nil end if bodyGyro then bodyGyro:Destroy() bodyGyro = nil end if humanoid then humanoid.HipHeight = defaultHipHeight end end local function startGlide() if gliding or not humanoid or humanoid.FloorMaterial ~= Enum.Material.Air then return end gliding = true bodyVel = Instance.new("BodyVelocity") bodyVel.MaxForce = Vector3.new(1e5, 1e5, 1e5) bodyVel.Parent = root bodyGyro = Instance.new("BodyGyro") bodyGyro.MaxTorque = Vector3.new(1e5, 1e5, 1e5) bodyGyro.P = TURN_POWER bodyGyro.Parent = root humanoid.HipHeight = GLIDE_HIPHEIGHT if glideTrack then glideTrack:Play() end end local function toggleGlide() if gliding then stopGlide() else startGlide() end end -------------------------------------------------- -- CHARACTER SETUP -------------------------------------------------- local function setupCharacter(character) stopGlide() char = character humanoid = char:WaitForChild("Humanoid") root = char:WaitForChild("HumanoidRootPart") defaultHipHeight = humanoid.HipHeight local anim = Instance.new("Animation") anim.AnimationId = GLIDE_ANIM_ID glideTrack = humanoid:LoadAnimation(anim) glideTrack.Looped = true glideTrack.Priority = Enum.AnimationPriority.Action end if player.Character then setupCharacter(player.Character) end player.CharacterAdded:Connect(setupCharacter) -------------------------------------------------- -- GLIDE MOVEMENT -------------------------------------------------- RunService.RenderStepped:Connect(function() if not gliding or not humanoid then return end if humanoid.FloorMaterial ~= Enum.Material.Air then stopGlide() return end local moveDir = humanoid.MoveDirection if moveDir.Magnitude < 0.1 then moveDir = root.CFrame.LookVector end bodyVel.Velocity = Vector3.new( moveDir.X * GLIDE_SPEED, FALL_SPEED, moveDir.Z * GLIDE_SPEED ) bodyGyro.CFrame = CFrame.new(root.Position, root.Position + moveDir) * CFrame.Angles(LEAN_ANGLE, 0, 0) end) -------------------------------------------------- -- GUI (RECTANGULAR, DRAGGABLE) -------------------------------------------------- local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui")) gui.Name = "GlideToggleUI" gui.ResetOnSpawn = false local button = Instance.new("TextButton", gui) button.Size = UDim2.fromOffset(90, 36) button.Position = UDim2.fromScale(0.1, 0.6) button.Text = "GLIDE" button.TextSize = 14 button.Font = Enum.Font.GothamBold button.BackgroundColor3 = Color3.fromRGB(35, 35, 35) button.TextColor3 = Color3.fromRGB(255, 255, 255) button.BorderSizePixel = 0 button.Active = true button.Draggable = true -- Small corner radius (rectangular, not round) local corner = Instance.new("UICorner", button) corner.CornerRadius = UDim.new(0, 6) button.MouseButton1Click:Connect(function() toggleGlide() button.BackgroundColor3 = gliding and Color3.fromRGB(60, 180, 255) or Color3.fromRGB(35, 35, 35) end) -------------------------------------------------- -- ⌨️ F KEYBIND (PC) -------------------------------------------------- UserInputService.InputBegan:Connect(function(input, gpe) if gpe then return end if input.KeyCode == Enum.KeyCode.F then toggleGlide() button.BackgroundColor3 = gliding and Color3.fromRGB(60, 180, 255) or Color3.fromRGB(35, 35, 35) end end)