For some reason the spawn locations in my game work with a 50/50 chance. Sometimes it spawns the player in the right spawn and sometimes it spawns them at the neutral spawn.
The logic in the system is pretty simple
Player selects a team → Client asks the sever to respawn character → Server calls :LoadCharacter() on the player.
First I thought it was because of a delay so I added a wait in the script which didn’t fix it. I tried printing the player’s team name in the server script before calling the :LoadCharacter() and it prints the right team name but it spawns the player only in the neutral spawn regardless a good 50% of the time.
self.Client.RespawnCharacter:Connect(function(Player)
local Character = Player.Character if not Character then return end
local Humanoid = Character.Humanoid
print(Player.Team)
Player:LoadCharacter()
task.wait()
Player:LoadCharacter()
return true
end)
Client Code
-- After clicked
CharacterService.RespawnCharacter:Fire()