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

Script Won't return to back to the lobby?

Asked by 6 years ago

Hello I have a problem with my roundscript It is a really big script so I will show you a piece of it Btw when I set players to 1 (not 2) it works (In roblox studio) But when I set players to 2 it won't work.

status.Value = "Be The Last Standing!"
if status.Value then
    game.Workspace.Sound:Stop()
end
wait(4)
for i = 196,0,-1 do -- You can adjust the #196 to how long you want the round to last.
    if i == 0 then
        status.Value = "Time is up!"
        wait(3)
        break
    end
    wait(1)
    if #_G.gameplayers == 1 then
        for i, v in pairs(_G.gameplayers) do
            if v ~= nil then
                status.Value = v.." Won The Game!"
                game.Players[v].leaderstats.Cash.Value = game.Players[v].leaderstats.Cash.Value + 15 -- The #15 will be how much credit or cash is awarded to the player if there was only one player teleported.
                break
            end

        end
        break
    else
        status.Value = i.."..Seconds Remaining!"
    end
end
    for i, player in ipairs(game.Players:GetPlayers()) do
    if player.Character then
        local hum = player.Character:FindFirstChild('Humanoid')
        if hum then
            hum.Health = 0
        end
    end
end

mapstorage:ClearAllChildren()

wait(5)
end

I used this script so they would teleport to the lobby ~~~~~~~~~~~~~~~~~ for i, player in ipairs(game.Players:GetPlayers()) do if player.Character then local hum = player.Character:FindFirstChild('Humanoid') if hum then hum.Health = 0 end end end ~~~~~~~~~~~~~~~~~ Every thing in the script works except that they will return to the lobby. Any solutions?

1 answer

Log in to vote
0
Answered by 6 years ago

Lines 16 and 17. Change [v] to [v.Name] and v.Name.."Has won"

0
Didn't work :( thebigwalkingdoor 0 — 6y
Ad

Answer this question