How do you run a function a certain amount of times?
I want to make my function, addplate(), to run as many times as the total number of values in my table. I've tried multiple ways but here's my best one. It only runs once. Line 38 was my attempt.
01 | function addplate(player) |
02 | local allplates = plates:GetChildren() |
03 | local newplate = allplates [ math.random( 1 , #allplates) ] :clone() |
04 | newplate.Parent = workspace.Plates |
05 | newplate.Player.Value = player.Name |
10 | plateholder:ClearAllChildren() |
16 | for _, player in pairs (game.Players:GetPlayers()) do |
17 | if player and player.Character then |
18 | local humanoid = player.Character:WaitForChild( "Humanoid" ) |
19 | if humanoid and humanoid.Health > 0 then |
20 | table.insert(contestants, player) |
24 | if #contestants > = 1 then |
27 | statustag.Value = "Waiting for Players" |
34 | statustag.Value = "Loading Plates" |
38 | for _, player in pairs (contestants) do |
40 | statustag.Value = "Plates Loaded!" |