Random scripts from a table

Hey Devs! I have a more advanced question. I want to make a table with scripts that are randomly chosen when the timer hits 0. (I already have a timer and an event needs to be fired from a localscript) I’m not asking for full scripts, but for how it could be done. Thanks!

GUI Localscript timer (if helps):

local seconds = 30
while wait(1) do
	if seconds > 0 then
		seconds = seconds - 1
		script.Parent.Text = seconds
	elseif seconds <= 0 then
		seconds = 30
		script.Parent.Text = seconds
-- chosen script
	end
end
1 Like

You may want to look at using a module script then you would only need to require them when needed.

For the random part I would just place all of the module scripts in a folder then choose a child at random.

1 Like

math.random[TableHere](1, #TableName)

1 Like
local randomItem = someTable[math.random(#someTable)]
1 Like

Yes, this is precisely what I would do, sorry just didn’t want to do the full code for it as the rules say not to.