ObjectCamera Made using gpt chat by ERRO_422 (Update)
Key RequiredUniversal

ObjectCamera Made using gpt chat by ERRO_422 (Update)

Universal ScriptCavalo_4443Cavalo_4443 2K views 26 executesUpdated Oct 1, 2025
Unrated
00
Lua Script•193 lines (6254 chars)
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local playerGui = player:WaitForChild("PlayerGui")

-- Main GUI
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "CameraManagerGUI"
screenGui.Parent = playerGui
screenGui.ResetOnSpawn = false

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 320, 0, 300)
frame.Position = UDim2.new(0, 60, 0, 20)
frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
frame.BorderSizePixel = 0
frame.Parent = screenGui

-- Button creator
local function createButton(parent, text, posX, posY, width, height)
    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(0, width, 0, height)
    btn.Position = UDim2.new(0, posX, 0, posY)
    btn.Text = text
    btn.BackgroundColor3 = Color3.fromRGB(50,50,50)
    btn.TextColor3 = Color3.fromRGB(255,255,255)
    btn.Parent = parent
    return btn
end

-- Main buttons
local createBtn = createButton(frame,"Create",10,10,80,30)
local viewBtn = createButton(frame,"View",100,10,80,30)
local deleteBtn = createButton(frame,"Delete",190,10,80,30)
local teleportBtn = createButton(frame,"Teleport",10,50,300,30)
local highlightBtn = createButton(frame,"Highlight",10,90,300,30)

-- Toggle GUI button
local toggleBtn = Instance.new("TextButton")
toggleBtn.Size = UDim2.new(0,40,0,40)
toggleBtn.Position = UDim2.new(0,10,0,10)
toggleBtn.BackgroundColor3 = Color3.fromRGB(50,50,50)
toggleBtn.TextColor3 = Color3.fromRGB(255,255,255)
toggleBtn.Text = "≡"
toggleBtn.TextScaled = true
toggleBtn.Parent = screenGui
toggleBtn.ZIndex = 1

local guiVisible = true
toggleBtn.MouseButton1Click:Connect(function()
    guiVisible = not guiVisible
    frame.Visible = guiVisible
    listFrame.Visible = guiVisible
end)

-- Camera list
local listFrame = Instance.new("ScrollingFrame")
listFrame.Size = UDim2.new(0,300,0,150)
listFrame.Position = UDim2.new(0,10,0,130)
listFrame.CanvasSize = UDim2.new(0,0,0,0)
listFrame.ScrollBarThickness = 6
listFrame.BackgroundColor3 = Color3.fromRGB(45,45,45)
listFrame.Parent = frame

local uiListLayout = Instance.new("UIListLayout")
uiListLayout.SortOrder = Enum.SortOrder.LayoutOrder
uiListLayout.Padding = UDim.new(0,5)
uiListLayout.Parent = listFrame

-- Variables
local cameras = {}
local selectedObject = nil
local currentCamera = nil
local viewing = false

-- Highlight
local highlight = Instance.new("Highlight")
highlight.FillColor = Color3.fromRGB(0,255,0)
highlight.OutlineColor = Color3.fromRGB(0,255,0)
highlight.Enabled = false
highlight.Parent = workspace

-- Object selection
mouse.Button1Down:Connect(function()
    if mouse.Target then
        local obj = mouse.Target
        if obj:IsA("BasePart") then
            selectedObject = obj.Parent:IsA("Model") and obj.Parent or obj
            -- Only enable highlight if already toggled on
            if highlight.Enabled then
                highlight.Adornee = selectedObject
            end
        end
    end
end)

-- Update camera list
local function updateCameraList()
    for _,child in pairs(listFrame:GetChildren()) do
        if child:IsA("TextButton") then child:Destroy() end
    end
    for _, cam in ipairs(cameras) do
        local btn = Instance.new("TextButton")
        btn.Size = UDim2.new(1,0,0,30)
        btn.Text = cam.name
        btn.BackgroundColor3 = (currentCamera==cam.obj) and Color3.fromRGB(0,150,0) or Color3.fromRGB(60,60,60)
        btn.TextColor3 = Color3.fromRGB(255,255,255)
        btn.Parent = listFrame
        btn.MouseButton1Click:Connect(function()
            currentCamera = cam.obj
            if highlight.Enabled then
                highlight.Adornee = cam.obj
            end
            updateCameraList()
        end)
    end
    listFrame.CanvasSize = UDim2.new(0,0,#cameras*35)
end

-- Create camera
createBtn.MouseButton1Click:Connect(function()
    if selectedObject then
        for _, cam in ipairs(cameras) do
            if cam.obj == selectedObject then return end
        end
        table.insert(cameras,{obj=selectedObject, name=selectedObject.Name})
        currentCamera = selectedObject
        updateCameraList()
    end
end)

-- View / Stop viewing camera
viewBtn.MouseButton1Click:Connect(function()
    if currentCamera then
        viewing = not viewing
        if viewing then
            workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
        else
            workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
        end
    end
end)

-- Delete camera
deleteBtn.MouseButton1Click:Connect(function()
    if currentCamera then
        for i, cam in ipairs(cameras) do
            if cam.obj==currentCamera then
                table.remove(cameras,i)
                break
            end
        end
        currentCamera = nil
        viewing = false
        workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
        if highlight.Enabled then
            highlight.Adornee = nil
        end
        updateCameraList()
    end
end)

-- Teleport to camera
teleportBtn.MouseButton1Click:Connect(function()
    if currentCamera then
        local primary = (currentCamera:IsA("Model") and (currentCamera.PrimaryPart or currentCamera:FindFirstChildWhichIsA("BasePart"))) or currentCamera
        if primary and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
            player.Character.HumanoidRootPart.CFrame = primary.CFrame + Vector3.new(0,3,0)
        end
    end
end)

-- Toggle highlight button
highlightBtn.MouseButton1Click:Connect(function()
    if selectedObject then
        highlight.Enabled = not highlight.Enabled
        if highlight.Enabled then
            highlight.Adornee = selectedObject
        else
            highlight.Adornee = nil
        end
    end
end)

-- Update camera every frame (follow object if viewing)
game:GetService("RunService").RenderStepped:Connect(function()
    if viewing and currentCamera then
        local primary = (currentCamera:IsA("Model") and (currentCamera.PrimaryPart or currentCamera:FindFirstChildWhichIsA("BasePart"))) or currentCamera
        if primary then
            workspace.CurrentCamera.CFrame = CFrame.new(primary.Position + Vector3.new(0,5,10), primary.Position)
        end
    end
end)

Features & Information

This just puts a camera that follows objects (if anyone wants to see where objects go )
#Camera cam#Object

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts