Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I fix this random team script?

After the first time it stops making teams even and makes it like AllPlayers VS 0 players

local teams = {"Really red","Really blue"}

local config = script.Configuration

game.Players.PlayerAdded:connect(function(player)
 if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then

player.Chatted:connect(function(chatmsg)
				if chatmsg:sub(1,9) == "Randomize" then
				
local players = game.Players:GetChildren()
for i = 1,#players do
local ChosenTeam = teams[math.random(1,#teams)]

   players[i].TeamColor = game.Teams:findFirstChild(ChosenTeam).TeamColor -- Picks one of the brick colors out of the teams table
end
end
end)
end
end)

1 comment

0

Please place your script in a code block.

1 answer

Try putting math.randomseed(tick()), doing this will make the random numbers even more random, so to speak, otherwise you may find patterns. Add this to an lines previous to line 13, preferrably at the beginning of the script.

math.randomseed(tick())

1 comment

0

No didnt really do much. Found a pattern but then it stopped

This discussion is preserved as it was. New answers, comments, and votes are closed.