Cooldown by NoirSplash: Simple non-yielding module for managing time between actions

Cooldown is a (very) simple module intended to help with code organization and managing debounce. It works by keeping a cache of timestamps attached to identifying strings. The status of a cooldown is only evaluated when the identifier is called through the Cooldown.get() function meaning this module does not yield or do any background work aside from garbage collection.

This is not a timer module, meaning you will not be informed when a cooldown ends unless you actively check for it. That being said, this works great alongside existing timer modules; give it a try!

Read the full documentation on Github.
Get the Roblox Model or download the Latest Release.

If you have a comment or suggestion, feel free to reply to this post or make a request on the github repository. Cheers!

6 Likes

Why should we use this over RequestService?

oh yeah, it’s no longer public. This is a very welcomed resource.

I’d assume this would function best under a frame-based loop.

for what is this cooldown? because i am not so sure

This module works fine in loops because of the low overhead but if you find yourself using loops to check conditional statements it might be worthwhile to look into event-based programming or using one of the various timer modules available.

I use this module myself fairly often and decided to release it publically. Two situations I find myself using this module fairly often are to check client debounce on tools and remote requests. This resource is intended to primarily serve as an organizational tool to be able to set-and-forget.

oh ok makes sense now thank you for explaining to me