Camera not going to part!

hi, so basically when the player joins, I want the camera to be set to the specified camPart. The code is simple, yet it doesn’t work.

it doesn’t go past the print("got locals") and I don’t know why.

local plr = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local part = workspace:WaitForChild("camPart")
print('got locals')

if camera.CameraType == Enum.CameraType.Custom then
	print('detected that its custom')
		repeat
		camera.CameraType = Enum.CameraType.Scriptable
		print('set to scriptable')
	until camera.CameraType == Enum.CameraType.Scriptable
	print('cam type is scriptable')
	camera.CameraSubject = part
	camera.CFrame = part
	print('set cam to part')
end

if someone could help me figure out this problem, I would really appreciate it! :blush:

1 Like

I think the code is correct, try adding a task.wait(1) above your code, so that the game loads properly or game.Loaded:Connect

1 Like

update:

i fixed after i just removed the if statement

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.