Need a countdown or delay in your game that’s easy to use, reusable, and fully customizable?
This Timer module lets you run countdown timers with just a few lines of code—perfect for rounds, minigames, intermissions, cooldowns, UI progress, and more!
Features:
Plug-and-play: Instantly start timers with your custom logic for each tick, stop, or completion.
Fully event-driven: Hook into onTick, onStopped, and onCompleted without repeating logic.
Dynamic control: Start, stop, change time and callbacks at any point.
Script-friendly: Lightweight and doesn’t rely on external dependencies.
local timer = Timer.new(
10, --Duration
function(sec) print("Seconds left:", sec) end, --Tick function
function() print("Stopped!") end, --Stopped function
function() print("Done!") end --Completed function
)
timer:Start()
1. About the module link:
Sorry about that—I forgot to include the download link to the module! Here it is: Timer.rbxm (3.2 KB)
Feel free to download and check it out.
2. Why use this module instead of a custom timer?
This module is designed to save you time and make your code cleaner by:
Providing an easy-to-use, event-driven API: set custom functions for tick, stop, and finish without re-implementing the same logic over and over.
Avoiding code duplication: Instead of rewriting timer logic (and possible bugs) in every script, just require this once and use it anywhere.
Staying modular: You can edit, extend, or swap the timer easily without changing your game’s core systems.
Built-in reliability: Handles timing, callbacks, and state so you don’t have to worry about edge cases.
Well documented: Everything is explained in the module, so it’s easy for you (or your teammates) to use and maintain.
If your game needs a really advanced or unique timer, you’re free to customize it—but for most use cases, this module covers all common scenarios, letting you focus on gameplay, not boilerplate scripting!