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

Bad argument for coroutine.status() ?

Asked by 10 years ago
local scripty = script.Parent.otherlogic
function display(text)
    local text2 = game.ServerStorage.text.Value
    text2 = text
end

while true do
    repeat wait() until scripty.Name == "ready"

    local try = coroutine.create(function()
        repeat wait() until _G.Team2Player.Character.ingame.WalkSpeed == 0
        wait(3)
        if coroutine.status(try2) == "running" then
        coroutine.yield(try2)
        for i,v in pairs(game.Players:GetChildren()) do
            if v.TeamColor == "Bright blue" then
                v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
            end
        end
        display("Red captain has been frozen! Blue team wins!")
        wait(3)
        display("")
        elseif coroutine.status(try2) == "dead" then
            coroutine.yield(try)
        end
    end)

    local try2 = coroutine.create(function()
        repeat wait() until _G.Team1Player.Character.ingame.WalkSpeed == 0
        wait(3)
        if coroutine.status(try) == "running" then
            coroutine.yield(try)
            for i,v in pairs(game.Players:GetChildren()) do
            if v.TeamColor == "Bright red" then
                v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
            end
        end
        display("Blue captain has been frozen! Red team wins!")
        wait(3)
        display("")
        elseif coroutine.status(try) == "dead" then
            coroutine.yield(try2)   
        end
    end)

    coroutine.resume(try)
    coroutine.resume(try2)  
end

The error says that I put in a bad argument for coroutine.status. It also said that it expected a coroutine for the argument. But... they are coroutines.

Answer this question