How do I make FNAF office camera?

Hello devs! I am working on a FNAF game and I dont know how to make office camera.

PS : I tried using CFrame.lookAt but camera couldnt stop moving.

Thanks!

Maybe you can set the cameratype to Fixed so it focuses on one thing

You could set the CameraType to Scriptable, then set the CurrentCamera’s CFrame to 1 of the camera you could potentially click on, the back button would set it back to Custom

(Btw this would need to be done on a LocalScript to be able to get the Local Player’s Camera)

Code :

spawn(function()
	while wait() do
		if game.ReplicatedStorage.FNAFcam.Value == true then
			local lookAt = CFrame.lookAt(workspace.FNAFcam.Position, Mouse.Hit.p)
			if Camera.CameraType == Enum.CameraType.Custom then
				Camera.CameraType = Enum.CameraType.Fixed
				Camera.CameraSubject = workspace.FNAFcam
			end
			Camera.CFrame = lookAt
		else
			if Camera.CameraType ~= Enum.CameraType.Custom then
				Camera.CameraType = Enum.CameraType.Custom
				Camera.CameraSubject = Humanoid
			end
		end
	end
end)

I think Freddy already turned the lights off on Night 1

Why are you implementing a while wait() do loop? Is the FNAFcam supposed to be moving in any sort at all?

2 Likes

FNAFcam is part, and is not moving, its just part for CFrame.lookAt.

There’s a much more better way of approaching it though? Like I suggested earlier, you could create a Gui inside StarterGui where it shows all of the Cameras you can click on, then insert a script that’ll set its CameraType & CFrame to where that certain CamPart is upon clicking 1 of the Cameras

There’s really not a necessary to be putting it through a while wait() do loop

I want to create office camera scrolling… bruh.

which you could achieve by using tweenservice (for the camera scrolling left to right) (or couldnt you just rotate the camera part?)

1 Like

TweenService would possibly be better, since there is a TweenInfo property that allows you to repeat Tweens as much as you’d like

You can also reverse the Tween as well, and you can cancel it anytime when the Player clicks a different camera or when the Player has its monitor off the camera

1 Like