#I don't understand why isn't this working please help

14 messages · Page 1 of 1 (latest)

neat escarp
#

im sure its supposed to be #players - #alreadyCplayers instead of #players-alreadyCplayers

#

but i dont really know wwhat you are trying to do in that line

scenic burrowBOT
#

studio** You are now Level 2! **studio

neat escarp
#

anyone in player that isn't in alreadycp

#

That is what you are trying to do right

#

Pick a random player that isn't on alreadyCPlayers

#

idk why the hell you have weird variable names

#

Give me a second

#

I can show an examplr

#
local AlreadyCplayers = {}
local filteredPlayers = {} -- players table without AlreadyCplayers

for _, player in pairs(players) do
    if table.find(AlreadyCplayers, player) then return end -- check if player is in already choosen table, if so dont add it to the filtered table
    table.insert(filteredPlayers, player)
end

local choosenPlayer = filteredPlayers[math.random(1,#filteredPlayers)]
#

You have to make a new table

#

A list of players without the alreadychoosen

#

Then you pick random

#

lua methods are very basic javascript probably can do this in one line