{"id":"chroma-hade/stackmanager","name":"stackmanager","scope":"chroma-hade","platform":"roblox","description":"Stackable attribute flags for Roblox. Two stuns on one character, and it stays stunned until both are gone.","version":"1.0.0","latest":"1.0.0","versions":["1.0.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"56a95bdc957ddb1b7739dd055bda9b2bf56c7cd601f32b992c1794776206fce1","likes":0,"downloads":0,"install":"forest install chroma-hade/stackmanager","url":"https://forest.dev/p/roblox/chroma-hade/stackmanager","files":"https://api.forest.dev/ai/package/roblox/chroma-hade/stackmanager/files","readme":"# StackManager\n\nStackable attribute flags for Roblox! Put `Stun` on a character twice, and it stays stunned until both are gone. One ModuleScript, under 100 lines.\n\nHere's the problem it fixes. Two moves each stun someone for a second. The first one ends, sets `Stun` back to nil, and the second stun just vanishes halfway through. StackManager counts them, so the attribute only goes away when the last one does☆\n\n## Getting it\n\nGrab `StackManager.rbxm` from the [releases page](https://github.com/chroma-hade/StackManager/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]\nStackManager = \"chroma-hade/stackmanager@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 StackManager = require(ReplicatedStorage.Packages.StackManager)\n\nStackManager.AddStack(Character, \"Stun\", 1)\n```\n\nThat sets the `Stun` attribute on `Character` to `true` for one second. It's a plain attribute, so anything can check it without requiring StackManager at all!\n\n```lua\nif Character:GetAttribute(\"Stun\") then\n    return\nend\n```\n\nSet it on the server and clients see it too, since attributes replicate.\n\n## Keeping it on\n\nLeave out the time and the stack stays until you remove it. `AddStack` hands you the stack back for that.\n\n```lua\nlocal Blocking = StackManager.AddStack(Character, \"Blocking\")\n\nBlocking:Destroy()\n```\n\n`ClearStack` removes every stack with that name at once. Handy when getting hit should cancel whatever someone was doing.\n\n```lua\nStackManager.ClearStack(Character, \"Stun\")\n```\n\n## Values\n\nPass a number as the fourth argument and the attribute gets that instead of `true`.\n\n```lua\nStackManager.AddStack(Character, \"Slowed\", 2, 8)\n```\n\nEvery new stack writes its own value, so the newest one wins. The attribute still sticks around until the last stack is gone.\n\nWhen an object's Parent becomes nil, destroyed or not, every stack on it goes away and its attributes are cleared. No cleanup on your side☆\n\n## Everything\n\nThat's the whole API!\n\n| | |\n|---|---|\n| `StackManager.AddStack(Object, Name, LifeTime?, Value?)` | Adds one stack and returns it |\n| `StackManager.ClearStack(Object, Name)` | Removes every stack with that name |\n| `Stack:Destroy()` | Removes that one stack |\n\n## License\n\nMIT, so go wild☆ Just keep the license file around.\n","readmeTruncated":false}