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

How to keep the Camera locked at a position while following a Player's own Position?

Camera Manipulation is a pain for me. When I work on it for one simple thing, the next is just impossible or extremely hard for me to get right.

This time I want to have the camera to be locked on a part (BrickA) while following the position of a player if they are moving around in the world. Sounds simple but the following script I have seems to not want to do this even though I've read what each property of the Camera Object does (CameraSubject, Focus, and CFrame).

wait(3)
print("Start")

while true do
	game.Workspace.CurrentCamera.CameraSubject = game.Workspace.Player1.Head --This should have the Camera look at the head of the Player.
	
	game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(game.Workspace.CameraBricks.BrickA.Position) --This should be locking the camera to BrickA's Position.

	wait()
end

It's a basic script and I became frustrated with the last script after deleting it in rage so that's why there's no local variables setting currentCamera or LocalPlayer.

1 answer

http://wiki.roblox.com/index.php?title=API:Class/Camera/CameraType

I'm not sure if its the ones you want but there's a few that are similar to what you want.

Fixed : Camera is stationary.

Attach : Camera moves with the subject at a fixed offset and will rotate as the subject rotates.

Track: Camera moves with the subject but does not rotate automatically.

Watch : Camera is stationary but will rotate to keep the subject in the center of the screen.

1 comment

0

A simpler explanation of what these Types did helped. Thanks!

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