Change camera in a different room/location

hi, i want to change camera in a different location, if u dont understand wat am i saying then, let me explain: first, what i want to make is like in Lightbulb, like this

but i make it different, i make the camera face to player. so if the player move randomly, the camera just facing the player.
that image is my setup, the Cam is the camera part and the campos1 and campos2 is Camera Position, TCF2 and TCF1 is Touch Function, “Why did send us this image and wats the problem?” haha simple, i send u this image bcs u will be confused. “And wats is the main problem?”, haha ez, the main problem is yes dats the main problem, i put a touched function script at the TCF1 and TCF2

TCF1 script

e = false --debounce
script.Parent.Touched:Connect(function(h)
   	if not e then
   		if h then
   			e = true
   			workspace.Cam.Position = workspace.CamPos2.Position
            wait(1)
   			e = false 
   		end
   	end
end)

TCF2 script is same like TCF1 script but i change the line 6 into workspace.Cam.Position = workspace.CamPos1.Position, btw, i have tried using TouchedEnded function. but still doesnt work.
if u still doesnt get it then let me explain again, if the player Touch the TCF1 the Cam(Camera) will teleport to CamPos2. and if the player Touch the TCF2 the Cam will teleport to CamPos1. so like dat.
btw, im not gonna replies any comments for 6 or 8 hours maybe?, bcs imma go sleep :zzz:

On the player you’re probably going to want to use a LocalScript to get the players camera [using workspace.CurrentCamera], then updating its Position based on either its positon in workspace, or if that part was touched.

Also, use CFrame, not position as position does not contain rotation.

Try take a look at this: Customizing the Camera | Documentation - Roblox Creator Hub

Also I am pretty sure you need to change the CameraType to Enum.CameraType.Scriptable, more on CameraType here: Camera | Documentation - Roblox Creator Hub

1 Like

Hey, I’ve been wanting to do the same exact thing. If you wouldn’t mind could you make the code OpenSource? I can seem to figure out how to do it exactly. If not then it’s cool, it’s your code.