ModuleScript
local module = {} local replicatedStorage = game:GetService("ReplicatedStorage") local valuesFolder = replicatedStorage:WaitForChild("ValuesFolder") local timerValue = valuesFolder:WaitForChild("TimerValue") function module.deathmatch() print("Deathmatch") wait(timerValue.Value) -- Do gamemode stuff end return module
Main Script
gamemodeScript = require(selectedGamemode) gamemodeScript.deathmatch() -- Next
The module runs perfectly, but I don't know how to run a while loop that counts down while running the modules code. I haven't written all the modules code but it's gonna have code which checks when players die and adds points to teams. Thats irrelevant right now. I just need the module script to run for the set period of time and have a timer counting down while the module does the other stuff. And when that timer is up it continues onto the next step of code in the main script and the module script stops working until it is called again. Would a coroutine be used for this? If so, how would I implement it.