players = game.Players:GetChildren() local randomp = players[math.random(1,#players)] print(randomp.Name .. " is murderer") local randoms = players[math.random(1,#players)] print(randoms.Name .. " is sheriff") for i,v in pairs(players) do if v.Name ~= randomp.Name or randoms.Name then print(v.Name .. " is innocent") end end
Why dosent this work? It should pick 1 murder, 1 sheriff and the rest innocent, and print in the output "Player 1 is sheriff" or something like that
local sheriff local murderer local innocent = {} local players = game.Players:GetPlayers() murderer = players[math.random(#players)].Name sheriff = players[math.random(#players)].Name for i,v in pairs(players) do if v.Name ~= sheriff and v.Name ~= murderer then table.insert(innocent, v.Name) end end print("MURDERER: "..murderer,"SHERIFF: "..sheriff, "INNOCENTS: "..table.concat(innocent,", "))
Stop making these games, there's enough already.