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

For Players In Pairs Only Doing One Player?

Asked by 10 years ago

The script is breaking too early. I think it's because it is only adding one person to the table then stopping without adding others (or seeing if others can be added).

///ACTIVEPLAYERS TABLE BEING MADE

    while true do
        wait(5)
        ActivePlayers = {}
        for _, player in pairs(game.Players:GetPlayers()) do
            if player and player.Character then
                local humanoid = player.Character:WaitForChild("Humanoid")
                if humanoid and humanoid.Health > 0 then
                    table.insert(ActivePlayers, player)
                end
            end
        end
        if #ActivePlayers > 1 then
            break
        else
            wait()
        end
    end

///PROBLEMATIC PART:

~~~~~~~~~~~~~~~~~

while MasterTime.Value > 0 do wait(5) MasterTime.Value = MasterTime.Value - 1

    ReallyActivePlayers = {}
    for _, player in pairs(ActivePlayers) do
        if player then
            local character = player.Character
            if character then
                local MatchTag = character.Torso:FindFirstChild("MatchTag")
                local Humanoid = character:FindFirstChild("Humanoid")
                if MatchTag and Humanoid and Humanoid.Health > 0 then
                    table.insert(ReallyActivePlayers, player)
                end
            end
        end
    end
    if #ReallyActivePlayers <= 1 or MasterTime <= 0 then
        break
    end

end

~~~~~~~~~~~~~~~~~

0
Code block, not blockquote. Click the little blue Lua symbol on the right. Also be sure to do your tabbing. Perci1 4988 — 10y
0
Oh, sorry. That last end is getting me right now also. peterrhea 0 — 10y

Answer this question