How could I make camera focus on model

How could I make the player’s camera focus on the model that the player’s seat is attached to?

So basically when the player goes to sit down on a seat, how could I make their camera focus on the model that the seat is a part of.

Any help appreciated!

1 Like
local ccamera = workspace.CurrentCamera
local ts = game:GetService("TweenService")
ccamera.CameraType = "Custom"
local part = path_to_part

local Tween = ts:Create(ccamera,TweenInfo.new(5),{["CFrame"]=part.CFrame}):Play()
ccamera.CameraSubject = part

This is the code to change your camera

5 Likes

How can I make the camera only focus on the model/part when the player is in a seat?

You’d have to get the current camera and then connect it to the part.

Detect what vehicle the player is in using Humanoid.SeatPart. Then, you can adjust Camera.CameraSubject accordingly.

I tried setting the camera subject but I’m not sure what I’m doing wrong.

Here’s my code:

local LocalPlayer = game.Players.LocalPlayer
local Character = LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = workspace.CurrentCamera


function onSeated(isSeated, seat)
	if isSeated then
		
		print(seat.Name)
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CameraSubject = seat.CamPart
	end
end

Humanoid.Seated:Connect(onSeated)

I’m not getting errors in the output and the seat name is printing, also as you can see in the video Its changing the camera but the camera is not attaching to the cam part for some reason.

1 Like

I think it’s because you’re changing the camera type.
When in scriptable the default system completely turns off, so that you can create your own custom camera controller.