Like im murder mystery, Possesion the way it picks Innocent,Sherrif,Murder -In murder myster- Ghost,Human -In possesion-
✓ ANSWER ACCEPTED
How do I make a script that picks 3 teams with no team gui?
1 answer
✓ Accepted answer
You can hide the team gui (leaderboard) with:
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
We need to assign 3 teams: Innocent, Sherrif, Murder. We know that:
- You can only be in one team
- Sherrif and Murder team both have only one person
So, the best approach is to assign Sherrif and Murderer first and then assign everyone else to Innocent.
function ReOrganizeTeams()
if #game.Players:GetPlayers() <= 3 then
print("Not enough players")
return
end
local function random_index(tab)
return math.random(1, #tab)
end
local players = game.Players:GetPlayers()
local murderer = random_index(players)
players[murderer].TeamColor = BrickColor.Red() -- The murder team color
--remove the murderer from the table
table.remove(players, murderer)
local sherrif = random_index(players)
players[sherrif].TeamColor = BrickColor.Blue() -- sheriff team color
-- also remove the sheriff
table.remove(players, sherrif)
for _, player in pairs(players) do
player.TeamColor = BrickColor.Green() -- for everyone else assign innocent team color
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
So I put them into local scripts and Make a team gui with the 3 teams and then it will work?
This should run on the server as it otherwise would run that code for every player. You can create the team guis by checking the players' team colors -> blue = sherif, red = murderer, green = innocent.