Team Script Help

Hiii, I have this script, what the script do, it takes the user group rank and insert them into a team. It’s working but the problem is guests. When guests join the game it puts them as staff-Mauve, I have been trying put them on gymnasts-Institutional white but didn’t succeed. I will really appreciate any of your help.

game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(8137208) then
		if player:GetRankInGroup(8137208) >= 201 then
			player.TeamColor = BrickColor.new("Mauve")
		elseif player:GetRankInGroup(8137208) >= 0 then --Keep copying and pasting this for each team
			player.TeamColor = BrickColor.new("Institutional white")
		elseif player:GetRankInGroup(8137208) == 0 then --Keep copying and pasting this for each team
			player.TeamColor = BrickColor.new("Institutional white")
		end 
	end
end)

Try debugging. What if you did it like this?

game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(8137208) then
        if player:GetRankInGroup(8137208) >= 0 then --Keep copying and pasting this for each team
			player.TeamColor = BrickColor.new("Institutional white")

		elseif player:GetRankInGroup(8137208) >= 201 then
			player.TeamColor = BrickColor.new("Mauve")
		
		elseif player:GetRankInGroup(8137208) == 0 then --Keep copying and pasting this for each team
			player.TeamColor = BrickColor.new("Institutional white")
		end 
	end
end)

Does their color become institutional white?

1 Like
game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(8137208) then
		if player:GetRankInGroup(8137208) >= 201 then
			player.TeamColor = BrickColor.new("Mauve")
		elseif player:GetRankInGroup(8137208) >= 0 then --Keep copying and pasting this for each team
			player.TeamColor = BrickColor.new("Institutional white")
		else
			player.TeamColor = BrickColor.new("Institutional white")
		end 
	end
end)
1 Like

Hi!

Your current script only works on group members in general. If I were to join, it wouldn’t do anything, and probably put me on any team with AutoAssign turned on.

This should do the trick:

game.Players.PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(8137208) >= 201 then --Player is staff or higher.
		player.TeamColor = BrickColor.new("Mauve")
	elseif player:GetRankInGroup(8137208) >= 0 then --Player is in the group, but not staff.
		player.TeamColor = BrickColor.new("REGULAR MEMBER TEAM COLOR")
	else
		player.TeamColor = BrickColor.new("Institutional white") --Player isn't in the group at all, a "guest".
	end
end)
2 Likes