Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with tables?

Asked by 8 years ago

So I'm making a game where there are "rounds" where all the players fight, and in this script I'm trying to make a table of all the active players, and then if a player dies, they are removed from the table. For some reason, this part of the script just seems to be skipped, and I don't know why. Please help!

    local localtimer = roundtime
    activecontestants = {contestants}
    while localtimer > 1 do
        wait(1)
        localtimer = localtimer - 1
        status.Value = localtimer
        for _, player in pairs(activecontestants) do
            if player.Health == 0 then
                table.remove(activecontestants, player)
            end
        end
        if #activecontestants == 1 or localtimer <= 1 then
            break
        end
    end
0
Did you insert the contestants into activecontestants earlier in the script? Also, try printing at different parts of the code to see where exactly it's stopping. Pyrondon 2089 — 8y
0
To clarify: I meant is 'contestants' in line 2 defined earlier. Pyrondon 2089 — 8y

Answer this question