Role[Player] = Characters:GetChildren()[math.random(1, #Characters:GetChildren())]
for _, v in Players:GetPlayers() do
if v == Player then
continue
end
if Role[Player] == Role[v] then
Role[Player] = Characters:GetChildren()[math.random(1, #Characters:GetChildren())]
end
end
I tried to make it detect if other players have the same value than it re-rolls. But it isn’t working.
local Pool = Characters:GetChildren()
for _, plr in Players:GetPlayers() do
local ChosenIndex = math.random(#Pool)
Role[Player] = Pool[ChosenIndex]
table.remove(Pool, ChosenIndex)
end