Why does this script team me randomly

Here is the script,

local group = 5499985
local teams = {game.Teams["Year 7"], game.Teams["Year 8"], game.Teams["Year 9"], game.Teams["Year 10"], game.Teams["Year 11"]}

print("runs")
game.Players.PlayerAdded:Connect(function(plr)
	local rnd = math.random(1,5)
	print(rnd)
	
	if plr:IsInGroup(group) then
	if plr:GetRankInGroup(group) >= 109 then
		plr.Team = game.Teams["Senior Leadership Team"]

	
	elseif plr:GetRankInGroup(group) >= 102 and plr:GetRankInGroup(group) <= 108 then
		plr.Team = game.Teams["Member of Staff"]
	
	
	elseif plr:GetRankInGroup(group) == 101 then
		plr.Team = game.Teams["Special Educational Needs"]
	
	
	elseif plr:GetRankInGroup(group) == 100 then
		plr.Team = game.Teams["Sixth Form"]
	
	
	elseif plr:GetRankInGroup(group) == 99 then
		plr.Team = game.Teams["Year 11"]
	
	
	elseif plr:GetRankInGroup(group) == 6 then
		print("10 year")
		plr.Team = game.Teams["Year 10"]
	
	elseif plr:GetRankInGroup(group) == 5 then
		plr.Team = game.Teams["Year 9"]
	
	
	elseif plr:GetRankInGroup(group) == 4 then
		plr.Team = game.Teams["Year 8"]
	
	
	elseif plr:GetRankInGroup(group) == 3 then
		plr.Team = game.Teams["Year 7"]
	
	
	elseif plr:GetRankInGroup(group) == 1 then
		plr.Team = teams[rnd]
	
	
	elseif plr:GetRankInGroup(group) == 0 then
		plr.Team = teams[rnd]
	end
	end
end)

Can you be more specfic. You made it so you get teamed randomly

How did I make it so you get teamed randomly? You get teamed randomly if your rank is below 1 and mine is not

1 Like

Which rank were you supposed to get? Do you get the same team every time you test it?

I figured the issue, it was with the team colours. Thanks for your effort

1 Like

Sorry even though you solved it, what was the problem with team colour (unless you mistaken the rank)?

The problem was all the colours were the same and I think that roblox teams you based on team colours

This shouldn’t be the case, the way you are doing it now should work just fine.

It can be the case but not sure about this. Teams change depending on the team colour, it will change to the corrosponding team that has the team colour.

Did you try changing the team colours?

I said I did that and it worked,

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