
KeylessUniversal

-- LocalScript (StarterPlayerScripts)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local flying = false
local speed = 60
local bodyVelocity
local bodyGyro
-- UI setup (mobile buttons)
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = player:WaitForChild("PlayerGui")
local upBtn = Instance.new("TextButton")
upBtn.Size = UDim2.new(0,100,0,100)
upBtn.Position = UDim2.new(1,-120,1,-220)
upBtn.Text = "UP"
upBtn.Parent = screenGui
local downBtn = Instance.new("TextButton")
downBtn.Size = UDim2.new(0,100,0,100)
downBtn.Position = UDim2.new(1,-120,1,-100)
downBtn.Text = "DOWN"
downBtn.Parent = screenGui
local toggleBtn = Instance.new("TextButton")
toggleBtn.Size = UDim2.new(0,120,0,50)
toggleBtn.Position = UDim2.new(0,20,1,-80)
toggleBtn.Text = "FLY"
toggleBtn.Parent = screenGui
local goingUp = false
local goingDown = false
upBtn.MouseButton1Down:Connect(function()
goingUp = true
end)
upBtn.MouseButton1Up:Connect(function()
goingUp = false
end)
downBtn.MouseButton1Down:Connect(function()
goingDown = true
end)
downBtn.MouseButton1Up:Connect(function()
goingDown = false
end)
-- Toggle flying
toggleBtn.MouseButton1Click:Connect(function()
flying = not flying
if flying then
bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(1,1,1) * 100000
bodyVelocity.Parent = hrp
bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(1,1,1) * 100000
bodyGyro.Parent = hrp
else
if bodyVelocity then bodyVelocity:Destroy() end
if bodyGyro then bodyGyro:Destroy() end
end
end)
-- Movement loop
game:GetService("RunService").RenderStepped:Connect(function()
if flying and bodyVelocity and bodyGyro then
local camera = workspace.CurrentCamera
local moveDir = humanoid.MoveDirection -- works with mobile joystick
local direction = (camera.CFrame:VectorToWorldSpace(moveDir)) * speed
-- Vertical movement
if goingUp then
direction = direction + Vector3.new(0, speed, 0)
end
if goingDown then
direction = direction - Vector3.new(0, speed, 0)
end
bodyVelocity.Velocity = direction
bodyGyro.CFrame = camera.CFrame
end
end)No comments yet for this script.



