Free cam open source
Key RequiredUniversal

Free cam open source

Universal ScriptCosmosCosmos 1K views 2.3K executesUpdated Feb 19, 2026
Unrated
00
Lua Script•196 lines (6448 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

local PlayerModule = require(player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"))
local controls = PlayerModule:GetControls()

local tool = Instance.new("Tool")
tool.Name = "📸 Free Cam"
tool.RequiresHandle = false
tool.Parent = player:WaitForChild("Backpack")

local gui = Instance.new("ScreenGui")
gui.Name = "FreeCamGui"
gui.ResetOnSpawn = false
gui.Enabled = false
gui.Parent = player:WaitForChild("PlayerGui")

local tpButton = Instance.new("TextButton")
tpButton.Name = "TPButton"
tpButton.Size = UDim2.new(0, 50, 0, 50)
tpButton.Position = UDim2.new(1, -80, 0.5, -25) 
tpButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
tpButton.BackgroundTransparency = 0.3
tpButton.TextColor3 = Color3.fromRGB(255, 255, 255)
tpButton.Font = Enum.Font.GothamBold
tpButton.Text = "TP"
tpButton.TextScaled = true
tpButton.Parent = gui

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0.2, 0)
corner.Parent = tpButton

local draggingUI = false
local dragStart = nil
local startPos = nil
local hasDragged = false

tpButton.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        draggingUI = true
        hasDragged = false
        dragStart = input.Position
        startPos = tpButton.Position
        
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then
                draggingUI = false
            end
        end)
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if draggingUI and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
        local delta = input.Position - dragStart
        if delta.Magnitude > 5 then
            hasDragged = true
        end
        tpButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end
end)

tpButton.Activated:Connect(function()
    if not hasDragged then
        local char = player.Character
        if char and char:FindFirstChild("HumanoidRootPart") then
            char.HumanoidRootPart.CFrame = camera.CFrame
        end
    end
end)

local isEquipped = false
local speed = 120
local pitch = 0
local yaw = 0

local upValue = 0
local downValue = 0
local draggingCamera = false

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.E then upValue = 1 end
    if input.KeyCode == Enum.KeyCode.Q then downValue = 1 end
    if input.UserInputType == Enum.UserInputType.MouseButton2 or input.UserInputType == Enum.UserInputType.Touch then
        draggingCamera = true
    end
end)

UserInputService.InputEnded:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then upValue = 0 end
    if input.KeyCode == Enum.KeyCode.Q then downValue = 0 end
    if input.UserInputType == Enum.UserInputType.MouseButton2 or input.UserInputType == Enum.UserInputType.Touch then
        draggingCamera = false
    end
end)

UserInputService.InputChanged:Connect(function(input, gameProcessed)
    if gameProcessed and input.UserInputType == Enum.UserInputType.Touch then return end
    
    if isEquipped then
        local isMouse = input.UserInputType == Enum.UserInputType.MouseMovement
        local isTouch = input.UserInputType == Enum.UserInputType.Touch
        
        if isTouch or (isMouse and UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter) or (isMouse and draggingCamera) then
            local delta = input.Delta
            local sensitivity = 0.25
            
            yaw = yaw - math.rad(delta.X * sensitivity)
            pitch = math.clamp(pitch - math.rad(delta.Y * sensitivity), -math.rad(89), math.rad(89))
        end
    end
end)

local function onRenderStep(dt)
    if not isEquipped then return end
    
    local moveVector = controls:GetMoveVector()
    
    local totalMove = Vector3.new(moveVector.X, upValue - downValue, moveVector.Z)
    
    if totalMove.Magnitude > 0 then
        totalMove = totalMove.Unit * speed * dt
    end
    
    local rotationCFrame = CFrame.Angles(0, yaw, 0) * CFrame.Angles(pitch, 0, 0)
    
    camera.CFrame = CFrame.new(camera.CFrame.Position) * rotationCFrame * CFrame.new(totalMove)
end

tool.Equipped:Connect(function()
    isEquipped = true
    gui.Enabled = true
    
    local char = player.Character
    if char then
        local animateScript = char:FindFirstChild("Animate")
        if animateScript then
            animateScript.Enabled = false
        end
        
        local humanoid = char:FindFirstChildOfClass("Humanoid")
        if humanoid then
            local animator = humanoid:FindFirstChildOfClass("Animator")
            if animator then
                for _, track in ipairs(animator:GetPlayingAnimationTracks()) do
                    track:Stop()
                end
            end
        end

        if char:FindFirstChild("HumanoidRootPart") then
            char.HumanoidRootPart.Anchored = true
        end
    end

    camera.CameraType = Enum.CameraType.Scriptable
    
    local cx, cy, cz = camera.CFrame:ToEulerAnglesYXZ()
    pitch = cx
    yaw = cy
    
    if UserInputService.KeyboardEnabled and UserInputService.MouseEnabled then
        UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
    end
    
    RunService:BindToRenderStep("FreeCamUpdate", Enum.RenderPriority.Camera.Value + 1, onRenderStep)
end)

tool.Unequipped:Connect(function()
    isEquipped = false
    gui.Enabled = false
    
    local char = player.Character
    if char then
        local animateScript = char:FindFirstChild("Animate")
        if animateScript then
            animateScript.Enabled = true
        end

        if char:FindFirstChild("HumanoidRootPart") then
            char.HumanoidRootPart.Anchored = false
        end
    end

    camera.CameraType = Enum.CameraType.Custom
    camera.CameraSubject = player.Character and player.Character:FindFirstChild("Humanoid")
    
    UserInputService.MouseBehavior = Enum.MouseBehavior.Default
    RunService:UnbindFromRenderStep("FreeCamUpdate")
end)

Features & Information

Good free cam open source script

Community Comments (1)

CosmosCosmosFeb 19, 2026

Free cam script open source

More Scripts for Universal Scripts