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

Why isn't this working?

local fbi
local hitman local innocent = {}

local players = game.Players:GetPlayers() hitman = players[math.random(#players)].Name fbi = players[math.random(#players)].Name for i,v in pairs(players) do if v.Name ~= fbi and v.Name ~= hitman then table.insert(innocent, v.Name) end end

print("HITMAN: "..hitman,"FBI: "..fbi, "INNOCENTS: "..table.concat(innocent,", "))

It isn't working I don't know why though. I also need it so it will activate after a certain amount of time.

1 comment

0

If you put it into the code block, it would be easier to tell

1 answer

It is difficult to say why it isn't working. If you were to include an error message, it might help to determine the solution. However, there is nothing inherently wrong with the script you posted. Perhaps the problem is that it is running at an unexpected time. One possibility is that it runs at server startup. In that case, the number of players is zero, so you will get an error like

bad argument #1 to 'random' (interval is empty)

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