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

Camera subject not working?

So i'm trying to make the camera be scripted and looking at the player for character customization but for some reason its not working like that instead its looking somewhere completely different from where the camPart is in the workspace...

Here's my script

local target = game.Workspace.CamPart
local camera = workspace.CurrentCamera
local Cam = game.Workspace.Camera
local NewCam = Instance.new("Camera")

script.Parent.MouseButton1Down:connect(function(click)
Cam.Parent = game.Lighting
script.Parent.Parent.Visible = false
NewCam.CameraType = Enum.CameraType.Scriptable
NewCam.FieldOfView = 70
wait(0.3)
Cam.CameraSubject = target
end)

1 answer

I'm not sure why you're creating another camera instance and why you have a second Cam variable referencing game.Workspace.Camera when you already have the camera. The camera you need is only game.Workspace.CurrentCamera, you just need to edit that camera, you dont need to create another one.

This should fix it.

local target = game.Workspace.CamPart
local camera = game.Workspace.CurrentCamera

script.Parent.MouseButton1Down:connect(function()
script.Parent.Parent.Visible = false
camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 70
wait(.3)
camera.CameraSubject = target
end)


1 comment

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