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

How do I fix my round ending script? The PLRS variable doesnt seem to work.

Asked by 3 years ago

Hello! I'm Poggers and I own Sword Battles by Point Interactive and I have a script which is supposed to run when a player is the last remaining and then teleport him to the lobby and get back to the intermission script but instead it doesnt run.

    if plrs == 1 then
            -- Last person Standing
            Status.Value = "The winner is "..plrs[1].Name
            plrs[1].leaderstats.SwordBucks.Value = plrs[1].leaderstats.SwordBucks.Value + rewards
            break
        elseif plrs == 0 then
            Status.Value = "Nobody won!"
            break
        elseif i == 0 then
            Status.Value = "Time up!"
            break
        end

This is the script ^ . and the plrs is

local plrs = {}

    for i, player in pairs (game.Players:GetPlayers()) do
        if player then
            table.insert(plrs,player)
        end
    end

Answer this question