For some odd reason, the code keeps on erroring, but, I am confused as to why, as it keeps giving the same error over-and-over again, and I am confused by the Error, the Output says 20:54:45.334 - TeamColor is not a valid member of Camera 20:54:45.335 - Script 'Players.Player.PlayerGui.setTeamSpawn', Line 8 - global setSpawn 20:54:45.336 - Script 'Players.Player.PlayerGui.setTeamSpawn', Line 16 20:54:45.339 - Stack End and 20:54:45.334 - TeamColor is not a valid member of Model 20:54:45.335 - Script 'Players.Player.PlayerGui.setTeamSpawn', Line 8 - global setSpawn 20:54:45.336 - Script 'Players.Player.PlayerGui.setTeamSpawn', Line 16 20:54:45.339 - Stack End.
I am not too sure why the code keeps erroring as-is, because, the code does not use the Camera object, and keeps thinking I'm trying to use the Model, thus, my confusion on the code.
This is the code I am using;
repeat wait() until game:GetService("Teams") and game.Players.LocalPlayer.TeamColor --Last resort, since it kept on saying those errors, but, it continues ;-;
local plr = game.Players.LocalPlayer;
function setSpawn()
for i,v in pairs(game.Workspace:GetChildren()) do
for i2,v2 in pairs(game:GetService("Teams"):GetChildren()) do
if (v.TeamColor == plr.TeamColor and v2.TeamColor == plr.TeamColor) then
plr.TeamColor = plr.TeamColor or v2.TeamColor
plr.Character:MoveTo(v.Position)
end
end
end
end
setSpawn()
game.Players.LocalPlayer.Changed:connect(function(prop)
if prop == "Character" then return end --To prevent the 'Model' error from showing up; This did not prevent it :(
setSpawn()
end)

2 comments
Why are you using nested "for" loops? And why are you iterating over "game.Workspace?" On line 7, "TeamColor" will be nonexistent , because "v" is in "game.Workspace, the same place where "Camera" is at.
That makes a lot of sense. o_e Also, the purpose of this code is due to a Bug in ROBLOX, well, for me at least; It keeps setting any Person's Spawn Point to a Random team location, or, a random 'SpawnLocation' that is not a specific Player's Team.