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

Table won't read?

Asked by
Cuvette 246 Moderation Voter
8 years ago

Long story short... It's quite simple yet I can't get it to work for me, the table is supposed to display the names of those who survived. Yet it prints nothing.

I've tried printing players[i] and it only grabs the name of one player who survived.

for i=1,#players do
        local survived = getTag(players[i], "BoolValue", "survived", false)
        if survived then
            setTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Coins", getTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Coins", 0) + math.random(5,10))
            setTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Tokens", getTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Tokens", 0) + 2)
            setTag(players[i]:findFirstChild("leaderstats"), "IntValue", "XP", getTag(players[i]:findFirstChild("leaderstats"), "IntValue", "XP", 0) + math.random(5,20))
            table.insert(survivedt, players[i])
            wait(0.2)
            _G.survivedp = (table.concat(survivedt,' '))
        end
        wait(0.4)
    end

Answer this question