It would fail. You use the # operator before the table, not after it.
p = game.Players:getChildren()
zombies = {}
local percent = #p * .3
for z = 1, percent do
tabl.insert(zombies, p[math.random(1,#p)]
end
for i, v in pairs(p) do
for _, q in pairs(zombies) do
if (v == q) then
v.TeamColor = BrickColor.new("Bright green")
else
v.TeamColor = BrickColor.new("Bright red")
end
end
I like making things more complicated but more efficient :D |