So I made a settings GUI that allows people to change their teams. However, if the player dies, they only spawn at their previous spawn location (the team they were auto-assigned with), even when I've assigned the player's new RespawnLocation.
I have two teams: Red Team and Blue Team. These teams exist ingame, and the rest of my GUI functions as I expect.
I'm giving you my code, but only the lines of code changing the teams, as my only problem is why the player doesn't respawn at the new team spawn locations, there's no other problem.
game.Players.LocalPlayer.Team = game.Teams["Red Team"] local spawns = game.Workspace.Spawn.RedSpawn:GetChildren() local random = math.random(1, #spawns) game.Players.LocalPlayer.RespawnLocation = spawns[random]
game.Players.LocalPlayer.Team = game.Teams["Blue Team"] local spawns = game.Workspace.Spawn.BlueSpawn:GetChildren() local random = math.random(1, #spawns) game.Players.LocalPlayer.RespawnLocation = spawns[random]
Nevermind. I've managed to solve it myself.