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,", "))
Ok, so I have tried the wiki, for about 4 hours, with no luck. This script will pick 1 murder, 1 sheriff, and the rest innocent, but I need another script within a gui needs to read this and check what role a player has, so it tells the players what role they have. Anyone have a solution
Roblox Roblox locked the source property of scripts, my best solution I could give is using the _G. Tag to make the innocent table and murder/sheriff tags a global value to be used throughout the game.
The script would receive all global variables. If you want a Global function, go here. If you just want a variable? Go here.
So, in your case, you'd put _G.Players
or _G.murderer
.
Also, remove line 1 and 2.
~ Thank me by accepting this answer.
Or use the solution I told you in the other post you made. No double posts please.