I’m currently making a tile game, and I want random things to happen to the tiles. I have a central script in ServerScriptService which controls the events in my game. There’s a module script inside of it called ‘Functions’ which houses all the random events I want to run.
My question is, is there a way to randomly select and run functions that are in that module script?
GameManager:
local functions = require(script.Functions)
while true do
-- I want to randomly select a function from the module script and play it here
end
Functions:
local functions = {}
function functions.SetBrickOnFire()
print('Set brick on fire')
end
function functions.ChangeBrickColor()
print('Changed brick color')
end
return functions
I want the script to choose between all the functions and select one, then run it. Is this possible?
If more clarification is needed, please let me know. All input is appreciated, thanks!