Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Camera subject not working?

Asked by
Prioxis 673 Moderation Voter
8 years ago

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

Log in to vote
1
Answered by
4Bros 550 Moderation Voter
8 years ago

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)


Ad

Answer this question