Skipping Remaining Lines?

Yea maybe spread
if character:FindFirstChild(“Died”) then break end
throughout your script. not the best way though

Is there any way to break the while loop outside it? Neither can I use a even or function to break it sadly.

I suppose you could use a function that accepts a variable on which action to run, and exits out if no players are left.

local function runAction(action)
    if (--[[ player died ]]) then
        return
    end

    if (action == "action1") then
        -- do stuff
    elseif (action == "action2") then
        -- do stuff
    end

    return true
end

local running = true
local actions = { "action1", "action2" }

while running do
    for _, action in next, actions do
        if (not runAction(action)) then
            running = false
            break
        end
    end
end
1 Like

I will try it, it might work :smiley: