Whenever a player switches teams, it fires an event to the server. Then the server checks and so forth as shown in the code below. But there seems to be a 10%-30% chance of the player not spawning at the correct spawn when they switch teams. It spawns them at the “Spectator” spawn, which is the only neutral and auto-assigned team.
if team == "British" then
if #britishteam <= #frenchteam then
CRegiment.Value = regiment
player.Team = game:GetService("Teams").British
CRegiment.Value = regiment
wait(.5)
player:LoadCharacter()
end
elseif team == "France" then
if #frenchteam <= #britishteam then
CRegiment.Value = regiment
player.Team = game:GetService("Teams").French
CRegiment.Value = regiment
wait(.5)
player:LoadCharacter()
end
end
Roblox provides you one, which you can change the player’s team and use player:LoadCharacter() to teleport the player to a spawnlocation where you must go to properties and select the team.
I’m guessing it’s a weird issue with how long you’re waiting, if you made it 2 seconds rather than .5, it would probably work all the time (or so I think). Glad that worked at the very least.