Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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)
Ad

Answer this question