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

How do i make the player's camera attach to a part ?

So i'm trying to make the player's camera attach to the part but i want it so that the player cant move his camera (like scriptable)

however, when i set the cameratype to Scriptable, it doesn't attach itself to the part. When i set it to Attach, it attaches however the player is able to move the camera up and down.

If anybody can help me out here, please do. Thanks!

1 answer

✓ Accepted answer

So you want to set the camera's cframe manually before it renders to the part so it will work and not look laggy. Of course you could still use while loops for consoles ;)

local RunService = game:GetService("RunService")

-- "camera" is the name
-- 199 is the priority just before the camera
-- the next param is just an anonymous function
RunService:BindToRenderStep("camera", 199, function() 
	workspace.CurrentCamera.CFrame = workspace.Part.CFrame
end)

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