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

How do you run a function a certain amount of times?

Asked by 5 years ago

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.

01function 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
06end
07 
08while true do
09    print ("start")
10    plateholder:ClearAllChildren()
11 
12    --Wait for players
13    while true do
14        wait(5)
15        contestants = {}
View all 41 lines...

Answer this question