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

How do you make a camera follow a person but still be able to move the camera?

I was able to get the camera to follow a person, but the camera position doesn't move. Just the angle. I am using a hopperbin tool. And this is a localscript which is a direct child of the hopperbin.

Cam = game.Workspace.CurrentCamera
Player = script.Parent.Parent.Parent
Count = 0

function onKeyDown(key) 
	Players = game.Players:getChildren()
    lkey = key:lower()
	
	if lkey == "e" then
		Count = Count+1
		if Count>#Players then
			Count = 1
		end
		if Players[Count]~=Player then
			Cam.CameraSubject = Players[Count].Character.Head
		else
			Count = Count+1
			if Count>#Players then
				Count = 1
			end
			Cam.CameraSubject = Players[Count].Character.Head
		end
	end
	if lkey == "q" then
		Count = Count-1
		if Count<1 then
			Count = #Players
		end
		if Players[Count]~=Player then
			Cam.CameraSubject = Players[Count].Character.Head
		else
			Count = Count-1
			if Count<1 then
				Count = #Players
			end
			Cam.CameraSubject = Players[Count].Character.Head
		end
	end
end
function UnEquipped()
	game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
	game.Workspace.CurrentCamera.CameraType = "Custom"
end
function onSelected(mouse) 
mouse.KeyDown:connect(onKeyDown) 
end 
script.Parent.Deselected:connect(UnEquipped)
script.Parent.Selected:connect(onSelected)

1 answer

You have to change the Camera's Coordinate Frame to anywhere near the spectated player's head so they are visible on the screen.

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