Help, why is this script affecting the camera for all players?

I’ve been trying to make it so when a player teleports their camera changes to that room they teleported to, it mostly works now but when I tested it with two people. Both their cameras change to that room when the other person didn’t teleport over, like it was affecting the camera for all players. I’m trying to make it change the camera on the client side not globally

local camera = game.Workspace.CurrentCamera
local part = workspace.CameraPart1
local part2 = workspace.CameraPart2
local point2 = workspace.tpdoor.tpposition
local point1 = workspace.ppoint1

local FOVroom1 = 15.6
local FOVroom2 = 15.6

point1.Touched:Connect(function()
	wait(.01)
	camera.FieldOfView = FOVroom1
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part.CFrame
end)


point2.Touched:Connect(function()
	wait(.01)
	camera.FieldOfView = FOVroom2
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part2.CFrame
end)
2 Likes

Because it’s in StarterPlayerScripts it’ll execute for every player when he/she first joins the game, if you need to manipulate the camera of specific players you need to be isolating player objects and modifying their cameras only.

4 Likes

You need to check if the local player’s character touched the part, otherwise it will activate whenever the part is touched by anybody.

3 Likes

ok thx i’ll do that when i get back home thanks guys

i’m only really good at conceptualizing game designs not actually being good at making them but thx

yay i got it thanks guys yeah ur right haha it was an easy fix