Hey guys,
I have a table in my script where it's a cooldown where every userId is placed in it. I want to detect when a value is added to it then wait a certain amount and then remove the user.
I know how to achieve that but my issue here is I only get to wait for the first value in the table.
Here is my attempted code.
local CooldownList = {}
--I insert values in the table elsewhere
coroutine.wrap(function()
print("Running coroutine")
while true do
wait()
if #CooldownList >= 1 then
coroutine.wrap(function()
repeat
print("Waiting and trying to remove user from array")
wait(45)
table.remove(CooldownList, 1)
print("Successfully removed user from array")
until #CooldownList < 1
end)()
end
end
end)()
Tbh, I just went with coroutines because I thought that was best.
Have a great day everybody ;)
