lastnames = {"Aaron","Abel","Abernathy","Abney","Abraham","Acker","Ackerman","Adam","Adams","Adkins","Agee","Ahmed",
"Aiken","Ainsworth","Akers","Albert","Albertson","Alderman","Aldrich","Aldridge","Aleman","Alexander","Alford",
"Alger","Ali","Allen","Allison","Allman","Almond","Alonzo","Alston","Ambrose","Ammons","Amos","Anderson","Andrews",
"Angel","Anthony","Antoine","Antonio","Archer","Armstead","Armstrong","Arnett","Arrington","Arthur","Ashcraft",
"Ashford","Atchison","Atkins","Atkinson","Atwood","August","Augustine","Austin","Avery","Ayers","Bacon","Badger",
"Baer","Bagley","Bailey","Baker","Baldwin","Bales","Ball","Banks","Barber","Barbosa","Barden","Barfield","Barker",
"Barkley","Barlow","Barnard","Barnes","Barnett","Baron","Barrett","Barrow","Barry","Barton","Bass","Bachelor",
"Bates","Batten","Battle","Bauer","Baughman","Baumann","Baxley","Bayer","Baylor","Beach","Beal","Bean","Beasley",
"Beaver","Beckham","Beckman","Bedford","Beeler","Begley","Belanger","Bell","Belt","Bender","Benedict","Benjamin",
"Benner"}
firstnames = {"Andrew","Chris","David","James","Michael","Tim"}
positions = {"GK","CBL","CBR","FBL","FBR","AML","AMC","AMR","LST","CST","RST"}
game.Players.PlayerAdded:connect(function(user)
team = Instance.new("ObjectValue",user)
team.Name = "Team"
starters = Instance.new("ObjectValue",team)
starters.Name = "Starting 11"
subs = Instance.new("ObjectValue",team)
subs.Name = "Substitutes"
reserves = Instance.new("ObjectValue",team)
reserves.Name = "Reserves"
for i = 1, 11 do
local player = Instance.new("ObjectValue",starters)
player.Name = lastnames[math.random(1,#lastnames)]
local fn = Instance.new("ObjectValue",player)
fn.Name = firstnames[math.random(1,#firstnames)]
pos = Instance.new("StringValue",player)
pos.Name = "Position"
pos.Value = positions[i]
table.remove(positions, i)
end
end)
This errors on the 7th time through the for loop, but why does it work until it reaches that point?

1 comment
Thanks. I totally forgot about that.