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 a camera act like the old follow camera?

So I'm trying to fix an old game from around 10 years ago. In the game, there is a button that activates follow camera, so the camera can go through the vehicle you're sitting in, and it follows the vehicle.

But some Roblox update completely broke that, so now it can't go through the vehicle, and it doesn't even follow the vehicle anymore. I tried searching for fixes to the problem, but the only one I could find involved changing the transparency of the vehicle, which I do not want to do. Is there any way to make the camera act like the old follow camera by just changing code and/or properties?

Here is the very short code that does the actual camera changing.

workspace.CurrentCamera.CameraSubject = vehicle
workspace.CurrentCamera.CameraType = 4

"vehicle" is the vehicle model.

1 answer

✓ Accepted answer

Hey there! I'm not really sure what you've meant but here is something I've cooked up for you.

Also be sure that the 'vehicle' so the part that you're trying to set the subject to isn't a model as it won't work , it needs to be a part. And don't forget that this only works as a localscript as these actions can only be done on the client's side.

This code is to change the camera's settings to follow:

local camera = workspace:FindFirstChild("Camera");
camera.CameraSubject = vehicle
camera.CameraType = Enum.CameraType.Follow

and back :

local player = game:GetService("Players").LocalPlayer
local camera = workspace:FindFirstChild("Camera");
local character = player.Character or workspace:FindFirstChild(player)
camera.CameraSubject = character.HumanoidRootPart
camera.CameraType = Enum.CameraType.Custom

Hope this is what you were looking for.

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