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

How do you make the camera go inside of a part?

I have been trying to make the camera go inside of a object but it doesn't move to that object.

local c = workspace.Camera
local cc = workspace.CurrentCamera
c.CameraSubject = workspace.Gadgets.Model.Part2
c.CameraType = "Scriptable"
cc.CameraSubject = workspace.Gadgets.Model.Part2
cc.CameraType = "Scriptable"

I put that code in a localscript inside of StarterGui. Help please.

3 comments

0

cc.Parent = workspace.Gadgets.Model.Part2

0

pretty epic

0

local cc = workspace.CurrentCamera; cc.CameraType = Enum.CameraType.Scriptable; cc.CFrame = workspace.Gadgets.Model.Part2.CFrame

1 answer

Local Script

local player = game.Players.LocalPlayer
local part = workspace.Gadgets.Model.Part2

local c = workspace.Camera
c.CameraSubject = workspace.Gadgets.Model.Part2
c.CameraType = Enum.CameraType.Scriptable

local cc = workspace.CurrentCamera
cc.CameraSubject = workspace.Gadgets.Model.Part2
cc.CameraType = Enum.CameraType.Scriptable

player.CameraMode = Enum.CameraMode.LockFirstPerson

If you've seen the Camera Modes in the player (Default is Classic), the second option, as depicted above, is "LockFirstPerson" which will put the camera in the POV of the Part you're changing the camera subject to (Doing this with the normal player will place the camera CFrame within the player's Head).

I recommend doing this after you've set the camera subject, or else it will occur too early. The only drawback to this is that the mouse cannot freely move around the screen, and must stay in the center.

Also, using the CameraType's Enum is better to prevent glitches, even though the string itself usu. works.

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