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

Players spawn Camera issues?

Okay so team (Bright Red)players attaches its camera to "Campart1"

team (Bright blue)players does not attach to its destination which is "Campart2" it just stays at where the spawn is at.

Help me have (Bright blue) players go to its destination "Campart2"

for i,v in pairs(game.Players:GetChildren())do
    if v.TeamColor == BrickColor.new("Bright red") then
    local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = game.Workspace:WaitForChild('CamPart1')
cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart1').Position + Vector3.new(0,0,0))
    elseif i.TeamColor == BrickColor.new("Bright blue") then
    local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = game.Workspace:WaitForChild('CamPart2')
cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart2').Position + Vector3.new(0,0,0))
end
end

1 answer

You just used "i" instead of "v" in your elseif

for i,v in pairs(game.Players:GetChildren()) do
    if v.TeamColor == BrickColor.new("Bright red") then
   	 local cam = game.Workspace.CurrentCamera
	cam.CameraType = Enum.CameraType.Scriptable
	cam.CameraSubject = game.Workspace:WaitForChild('CamPart1')
	cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart1').Position + Vector3.new(0,0,0))
    elseif v.TeamColor == BrickColor.new("Bright blue") then
    local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = game.Workspace:WaitForChild('CamPart2')
cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart2').Position + Vector3.new(0,0,0))
end
end

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