How would I go about making a script that will create the same CFrame as a part I want the camera to lock on? I tried using CameraSubject but I think I used it in the wrong way. Anyways, how would I make the script?
✓ 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.

1 comment
https://developer.roblox.com/en-us/api-reference/property/Camera/CameraType