The code below runs every function that's inside 'FunctionTable' on line 15 even tho I am only calling one of the functions using FunctionTable[counter]. Instead of running every function at once, how do i run a single function in the table for every time a player clicks a ClickDetector? Also, is there a better way of doing this?
counter = 1
function round1()
-- runs round1() code
end
function round2()
-- runs round2() code
end
function round3()
-- runs round3() code
end
FunctionTable = {
round1(),
round2(),
round3()
}
ClickDetector.MouseButton1Click:connect(function()
local CurrentRound = FunctionTable[counter] -- This line is running every function in 'FunctionTable'
counter = counter + 1
end)

1 comment
Thanks!