{"id":"chroma-hade/timemanager","name":"timemanager","scope":"chroma-hade","platform":"roblox","description":"Cooldowns for Roblox. Give one to a character, a player or just a name, and ask later whether it's done.","version":"1.0.0","latest":"1.0.0","versions":["1.0.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"8bd9b111097a57fc795d8c6b2b5e22bda25a87f4d72aed104cc49860634c310d","likes":0,"downloads":0,"install":"forest install chroma-hade/timemanager","url":"https://forest.dev/p/roblox/chroma-hade/timemanager","files":"https://api.forest.dev/ai/package/roblox/chroma-hade/timemanager/files","readme":"# TimeManager\n\nCooldowns for Roblox! Give one to a character, a player or just a name, and ask later whether it's done. One ModuleScript, under 100 lines.\n\n## Getting it\n\nGrab `TimeManager.rbxm` from the [releases page](https://github.com/chroma-hade/TimeManager/releases) and put it anywhere you can require it from, like `ReplicatedStorage.Packages`.\n\nIf you use Wally, add it to your `wally.toml`:\n\n```toml\n[dependencies]\nTimeManager = \"chroma-hade/timemanager@1.0.0\"\n```\n\nOr just copy `src/init.luau` into your project.\n\n## Using it\n\n```lua\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\n\nlocal TimeManager = require(ReplicatedStorage.Packages.TimeManager)\nTimeManager.SetCooldown(Character, { ID = \"Dash\", Time = 2 })\n```\n\nThat puts `Dash` on cooldown for two seconds. Check it before letting the dash happen again:\n\n```lua\nif TimeManager.IsOnCooldown(Character, \"Dash\") then\n    return\nend\n```\n\n`GetCooldown` gives you the seconds left instead, or `0` once it's done. Handy for a timer on a button.\n\nThe owner can be any Instance or a string, so a cooldown can belong to one character, one player, or the whole server, like `\"Airdrop\"`.\n\nIt works on the server and on the client, but each side keeps its own cooldowns. For anything players shouldn't be able to skip, check on the server!\n\n## When it runs out\n\nHand it an `OnFinished` function and it runs the moment the cooldown is over.\n\n```lua\nTimeManager.SetCooldown(Character, {\n    ID = \"Ultimate\",\n    Time = 30,\n    OnFinished = function()\n        print(\"Ultimate is ready!\")\n    end,\n})\n```\n\nSetting the same cooldown again restarts it, and only the newest `OnFinished` runs.\n\n## Ending it early\n\n```lua\nTimeManager.ClearCooldown(Character, \"Dash\")\nTimeManager.ResetCooldown(Character)\n```\n\n`ClearCooldown` ends one cooldown, and `ResetCooldown` ends every cooldown that owner has. Neither runs `OnFinished`.\n\nCooldowns clean themselves up once they run out, so there's nothing to tidy afterwards☆\n\n## Everything\n\nThat's the whole API!\n\n| | |\n|---|---|\n| `TimeManager.SetCooldown(Owner, Data)` | Starts a cooldown. `Data` takes `ID`, `Time` and an optional `OnFinished` |\n| `TimeManager.GetCooldown(Owner, ID)` | Seconds left, or `0` |\n| `TimeManager.IsOnCooldown(Owner, ID)` | Whether it's still going |\n| `TimeManager.ClearCooldown(Owner, ID)` | Ends one cooldown |\n| `TimeManager.ResetCooldown(Owner)` | Ends every cooldown that owner has |\n\n## License\n\nMIT, so go wild☆ Just keep the license file around.\n","readmeTruncated":false}