When a player joins, depending on their rank I want them to spawn at a certain RespawnLocation. The problem is when I test it, everyone spawns at the 1st spawn location and nobody that is supposed to go to the other one, is spawning there. Any ideas why? Thank you!

function onPlayerEntered(Player)
	Player.CharacterAdded:Wait()
	local Rank = Player:GetRankInGroup(1)
	game.Players.CharacterAutoLoads = false
	if Rank ~= 0 or Rank ~= 1 or Rank ~= 2 or Rank ~= 3 then
		Player.Team = game.Teams.Joining1
		Player.RespawnLocation = game.Workspace.TeamSpawns.Joining1Spawn
	else
			Player.Team = game.Teams.Joining2
			Player.RespawnLocation = game.Workspace.TeamSpawns.Joining2Spawn
			print("test2")
	end
	Player:LoadCharacter()
	Player.CharacterAdded:Connect(onPlayerRespawned)
    Player.CharacterAppearanceLoaded:Wait(onPlayerRespawned)
	game.ReplicatedStorage.PlayerAddedGui:FireClient(Player)
end
game.Players.PlayerAdded:Connect(onPlayerEntered)

1 is not the group, it's just for the example.

3 comments

0

Sorry, fixed formatting error.

0

Make sure your spawnlocation team color is correct

0

They're both correct