Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I lock my camera onto a certain part?

1 answer

✓ Accepted answer

Set camera cframe (in localscript) like this:

local function ShowMe(part)
    workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position, part.Position)
end
ShowMe(workspace:FindFirstChildWhichIsA("BasePart", true))

Note that in order to 'lock' onto a part, you'll need to make a loop, something like:

local part = workspace:FindFirstChildWhichIsA("BasePart", true)
local locked = true

while wait() do
    repeat
        if part then
            ShowMe(part)
        end
        game:GetService("RunService").RenderStepped:wait()
    until not locked or not part
end

This discussion is preserved as it was. New answers, comments, and votes are closed.