Smooth Fly Script
Key RequiredUniversal

Smooth Fly Script

Universal Scriptl4qicl4qic 1.9K views 1.5K executesUpdated Jun 20, 2026
0.0/ 5(1 votes)
010% Positive
Lua Script•98 lines (2967 chars)
-- Made By l4qic
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera

local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local flying = false
local speed = 100 -- adjust
local acceleration = 8
local currentVelocity = Vector3.new(0, 0, 0)

local bodyVelocity
local bodyGyro

local function startFlying()
	if flying then return end
	flying = true
	
	humanoid.PlatformStand = true
	
	bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
	bodyVelocity.Velocity = Vector3.new(0, 0, 0)
	bodyVelocity.Parent = character:FindFirstChild("HumanoidRootPart")
	
	bodyGyro = Instance.new("BodyGyro")
	bodyGyro.MaxTorque = Vector3.new(1e5, 1e5, 1e5)
	bodyGyro.P = 10000
	bodyGyro.D = 500
	bodyGyro.Parent = character:FindFirstChild("HumanoidRootPart")
end

local function stopFlying()
	if not flying then return end
	flying = false
	
	if bodyVelocity then bodyVelocity:Destroy() end
	if bodyGyro then bodyGyro:Destroy() end
	
	humanoid.PlatformStand = false
	currentVelocity = Vector3.new(0, 0, 0)
end

local function updateFly(dt)
	if not flying or not bodyVelocity or not bodyGyro then return end
	
	local moveDirection = Vector3.new(0, 0, 0)
	
	if UIS:IsKeyDown(Enum.KeyCode.W) then moveDirection = moveDirection + camera.CFrame.LookVector end
	if UIS:IsKeyDown(Enum.KeyCode.S) then moveDirection = moveDirection - camera.CFrame.LookVector end
	if UIS:IsKeyDown(Enum.KeyCode.A) then moveDirection = moveDirection - camera.CFrame.RightVector end
	if UIS:IsKeyDown(Enum.KeyCode.D) then moveDirection = moveDirection + camera.CFrame.RightVector end
	if UIS:IsKeyDown(Enum.KeyCode.Space) then moveDirection = moveDirection + Vector3.new(0, 1, 0) end
	if UIS:IsKeyDown(Enum.KeyCode.LeftControl) then moveDirection = moveDirection - Vector3.new(0, 1, 0) end
	
	-- normalize and apply acceleration
	if moveDirection.Magnitude > 0 then
		moveDirection = moveDirection.Unit
		currentVelocity = currentVelocity:Lerp(moveDirection * speed, acceleration * dt)
	else
		currentVelocity = currentVelocity:Lerp(Vector3.new(0, 0, 0), 0.1 * dt * 60)
	end
	
	bodyVelocity.Velocity = currentVelocity
	
	-- smoothly align character to camera direction
	local rootPart = character:FindFirstChild("HumanoidRootPart")
	if rootPart then
		bodyGyro.CFrame = CFrame.lookAt(rootPart.Position, rootPart.Position + camera.CFrame.LookVector)
	end
end

UIS.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if input.KeyCode == Enum.KeyCode.F then
		if flying then
			stopFlying()
		else
			startFlying()
		end
	end
end)

-- main loop
RunService.RenderStepped:Connect(function(dt)
	updateFly(dt)
end)

-- cleanup on character respawn
	character = newChar
	humanoid = newChar:WaitForChild("Humanoid")
	if flying then
		stopFlying()
	end
end)

Features & Information

F to Toggle WASD To Move (Or Joystick If You Are On Mobile) You Can Adjust The Speed / Acceleration

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts