How would I change the position of and rotate the camera?

Hello everyone!

I’m trying to make a script that when a player is sitting it will rotate their camera. The sitting part isn’t that hard, but what I’m confused about is how to move the camera.

How can I make it so the camera of that specific player moves to where I want it to go, smoothly? The Developer API article was interesting but I sadly did not understand most of it.

3 Likes

If you want to get the player’s camera put this in a Local Script

local camera = game.Workspace.CurrentCamera

Then you need to set up a camera type for the camera. To do you will need to change the CameraType. For you, the best one is to use Scriptable since this allows you to adapt the camera’s CFrame freely. Just remember to switch back the CameraType when the player stands up from the seat.

camera.CameraType = Enum.CameraType.Scriptable

--Adjust camera CFrame here

And to get the smooth camera motion to different positions I would use TweenService to manipulate CFrame values.

4 Likes

Thanks!

Just a question: which CameraType is the default so I know what to switch it back to?

Given their descriptions, I believe you set it to Custom. Sorry for the late reply I was busy.

2 Likes