Ultimax's Timer Module

so i’ve created a timer module in an attempt to sort of familiarize myself with the concepts of object-oriented programming. it was initially created for personal use, but i’ve decided to make it public.

the goods:
(1) Ultimax’s Timer Module - Roblox

well, now that you have my timer module, how do you use it?

the methods

  • CreateTimer: creates a new timer instance with a given name and callback function. the timer is stored in a “timers” table.
  • Start: initiates the timer with a specified duration in seconds. the timer counts down, and when it reaches 0, it invokes the callback function.
  • Pause: pauses the timer by disconnecting from the RunService.Heartbeat event.
  • Unpause: resumes a paused timer.
  • Stop: stops the timer, disconnects from the heartbeat event, and resets its properties.
  • GetTimers: returns a table of active timers.
  • GetTimer: returns a specific timer instance by name.

an advantage my timer module has is that callback functions can be provided when creating a timer to specify actions to be performed when the timer reaches 0.

in order to use the module, you can create timers using “CreateTimer” , start them with “Start” , pause and resume with “Pause” and “Unpause” , and stop them with “Stop” .

DISCLAIMER: my timer module uses RunService for timing, and the precision of timers may be affected by the frame rate

honest feedback is appreciated, as this is my first real resource on the dev forum!

4 Likes

This reliable timer module has saved me so much time; thank you for creating it!

5 Likes

thank you, but my transactions page states that the module has no sales?

3 Likes

I did install it, but the transaction source is Roblox.

3 Likes

I’m really concerned about this. Let’s say the server lags. The timer is just going to be delayed. Again, I don’t see much optimization in your code.

Of course, as your first resource, this is really amazing! Don’t get sad.

I’m not criticizing, I’m just giving a simple advice. You may look around the forum for more ideas on optimizing it. But good job on your first resource!

2 Likes