Spawn Location not working

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.

Can you send the script?

Yeah

Server Code

	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()

image

Probably because of this

Thanks! Not sure how I overlooked that believing that only people without a team spawn at the Neutral spawn. Much appreciated!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.