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

Why does this select multiple sometimes?

Asked by
ItsMeKlc 235 Moderation Voter
8 years ago

So basically whenever a player joins, my game assigns them a lot. Most of the time it works fine, but sometimes it selects multiple lots.. Any idea why? :l

function folder(c)
    local children1 = game.Workspace.game.Lots:GetChildren()
    for i = 1, #children1 do
        if children1[i].Taken.Value == ("") and children1[i]~=nil  then
    print("This lot is now mine!")
    children1[i].Taken.Value = (c.Owner.Value)
    c.LotNumber.Value = children1[i].Name
    break
    else
    wait()
    if i==#children1 then
    print("Not Open")
    folder(c)
    break
    end
    end
    end
end

Answer this question