
KeylessUniversal

--// Services
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
--// Player
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
--// State
local freeCamEnabled = false
local renderConnection
local currentCharacter = player.Character or player.CharacterAdded:Wait()
player.CharacterAdded:Connect(function(char)
currentCharacter = char
end)
--// =========================
--// GUI
--// =========================
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FreeCamGui"
screenGui.ResetOnSpawn = false
screenGui.IgnoreGuiInset = true
screenGui.Parent = player:WaitForChild("PlayerGui")
-- Main Window
local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.fromOffset(280, 140)
mainFrame.Position = UDim2.fromScale(0.5, 0.5)
mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
mainFrame.BackgroundColor3 = Color3.fromRGB(255,255,255)
mainFrame.BorderSizePixel = 0
mainFrame.Parent = screenGui
Instance.new("UICorner", mainFrame).CornerRadius = UDim.new(0,12)
-- Title
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -40, 0, 32)
title.Position = UDim2.fromOffset(20, 12)
title.BackgroundTransparency = 1
title.Text = "Free Camera"
title.Font = Enum.Font.GothamSemibold
title.TextSize = 22
title.TextColor3 = Color3.fromRGB(20,20,20)
title.TextXAlignment = Enum.TextXAlignment.Left
title.Parent = mainFrame
-- Toggle Button
local toggleButton = Instance.new("TextButton")
toggleButton.Size = UDim2.new(1, -40, 0, 48)
toggleButton.Position = UDim2.fromOffset(20, 60)
toggleButton.BackgroundColor3 = Color3.fromRGB(0,0,0)
toggleButton.TextColor3 = Color3.fromRGB(255,255,255)
toggleButton.Text = "Enable Free Cam"
toggleButton.Font = Enum.Font.GothamSemibold
toggleButton.TextSize = 18
toggleButton.Parent = mainFrame
Instance.new("UICorner", toggleButton).CornerRadius = UDim.new(0,12)
-- Floating Open Button
local openButton = Instance.new("TextButton")
openButton.Size = UDim2.fromOffset(48,48)
openButton.Position = UDim2.new(1,-60,1,-60)
openButton.AnchorPoint = Vector2.new(1,1)
openButton.BackgroundColor3 = Color3.fromRGB(240,240,240)
openButton.Text = "≡"
openButton.TextSize = 26
openButton.Font = Enum.Font.GothamSemibold
openButton.Visible = false
openButton.Parent = screenGui
Instance.new("UICorner", openButton).CornerRadius = UDim.new(1,0)
-- Dragging
local dragging, dragStart, startPos
mainFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true
dragStart = input.Position
startPos = mainFrame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
UserInputService.InputChanged:Connect(function(input)
if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
local delta = input.Position - dragStart
mainFrame.Position = UDim2.new(
startPos.X.Scale,
startPos.X.Offset + delta.X,
startPos.Y.Scale,
startPos.Y.Offset + delta.Y
)
end
end)
-- Close behavior
local close = Instance.new("TextButton")
close.Size = UDim2.fromOffset(28,28)
close.Position = UDim2.new(1,-36,0,8)
close.Text = "✕"
close.Font = Enum.Font.GothamBold
close.TextSize = 16
close.BackgroundColor3 = Color3.fromRGB(230,230,230)
close.Parent = mainFrame
Instance.new("UICorner", close).CornerRadius = UDim.new(0,8)
close.MouseButton1Click:Connect(function()
screenGui.Enabled = false
openButton.Visible = true
end)
openButton.MouseButton1Click:Connect(function()
screenGui.Enabled = true
openButton.Visible = false
end)
-- Keyboard GUI toggle
UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.F then
screenGui.Enabled = not screenGui.Enabled
openButton.Visible = not screenGui.Enabled
end
end)
--// =========================
--// FREECAM LOGIC
--// =========================
local function enableFreeCam()
if renderConnection then
renderConnection:Disconnect()
end
freeCamEnabled = true
camera.CameraType = Enum.CameraType.Scriptable
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
UserInputService.MouseIconEnabled = false
local camPosition = camera.CFrame.Position
local yaw = 0
local pitch = 0
local baseSpeed = 45
local sensitivity = 0.2
renderConnection = RunService.RenderStepped:Connect(function(deltaTime)
-- Mouse look
local delta = UserInputService:GetMouseDelta()
yaw -= delta.X * sensitivity
pitch -= delta.Y * sensitivity
pitch = math.clamp(pitch, -85, 85)
local rotation =
CFrame.Angles(0, math.rad(yaw), 0) *
CFrame.Angles(math.rad(pitch), 0, 0)
-- Movement
local move = Vector3.zero
if UserInputService:IsKeyDown(Enum.KeyCode.W) then move += Vector3.new(0,0,-1) end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then move += Vector3.new(0,0,1) end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then move += Vector3.new(-1,0,0) end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then move += Vector3.new(1,0,0) end
if UserInputService:IsKeyDown(Enum.KeyCode.Space) then move += Vector3.new(0,1,0) end
if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then move += Vector3.new(0,-1,0) end
if move.Magnitude > 0 then
move = move.Unit
end
local speed = baseSpeed
if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
speed *= 3
end
camPosition += rotation:VectorToWorldSpace(move) * speed * deltaTime
camera.CFrame = CFrame.new(camPosition) * rotation
end)
end
local function disableFreeCam()
if renderConnection then
renderConnection:Disconnect()
renderConnection = nil
end
freeCamEnabled = false
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
UserInputService.MouseIconEnabled = true
camera.CameraType = Enum.CameraType.Custom
local humanoid = currentCharacter:FindFirstChildOfClass("Humanoid")
if humanoid then
camera.CameraSubject = humanoid
end
end
toggleButton.MouseButton1Click:Connect(function()
if freeCamEnabled then
disableFreeCam()
toggleButton.Text = "Enable Free Cam"
else
enableFreeCam()
toggleButton.Text = "Disable Free Cam"
end
end)



W
ww