{"id":"sequesteredone/sworduh","name":"sworduh","scope":"sequesteredone","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.3.7-beta","latest":"0.3.7-beta","versions":["0.3.0-beta","0.3.1-beta","0.3.2-beta","0.3.3-beta","0.3.4-beta","0.3.5-beta","0.3.6-beta","0.3.7-beta"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{"evaera/promise":{"version":"^4.0.0","alias":"promise"}},"integrity":"34f69fb2d14097cf55a039d62c9e5eeaec5276cdf77d2be4d223f1433df6d447","likes":0,"downloads":0,"install":"forest install sequesteredone/sworduh","url":"https://forest.dev/p/roblox/sequesteredone/sworduh","files":"https://api.forest.dev/ai/package/roblox/sequesteredone/sworduh/files","readme":"# Sworduh\r\n\r\nSworduh is a server-side sword system for Roblox. It is designed to handle giving swords to players, tracking damage, and cleaning up resources automatically. It uses the classic linked sword mechanics, including slash and lunge attacks.\r\n\r\n> View the full [documentation](https://sequesteredone.github.io/Sworduh/)\r\n\r\n---\r\n\r\n## Install\r\n\r\n### Wally (Recommended)\r\n\r\n- Add to your wally.toml:\r\n\r\n```toml\r\n    [dependencies]\r\n    sworduh = \"sequesteredone/sworduh@0.3.5-beta\" # use latest version\r\n```\r\n\r\n- then run:\r\n\r\n`wally install`\r\n\r\n### Manual\r\n\r\n- Download the [.rbxm](https://github.com/SequesteredOne/Sworduh/releases) from the latest release\r\n\r\n- Insert the model into ReplicatedStorage and require it:\r\n\r\n```lua\r\n    local Sworduh = require(ReplicatedStorage.Sworduh)\r\n```\r\n\r\n## Basic Usage\r\n\r\nHere are a few common examples of how to use Sworduh.\r\n\r\n### Giving and Removing Swords\r\n\r\nYou can give a sword to a player when they join and remove it with the `Unsword` function.\r\n\r\n```lua\r\n    local ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\r\n    local Players = game:GetService(\"Players\")\r\n\r\n    local Sworduh = require(ReplicatedStorage.Sworduh)\r\n\r\n    Players.PlayerAdded:Connect(function(player)\r\n        -- Give a sword to the new player\r\n        -- The system waits for the character to load automatically\r\n        local sword = Sworduh:Sword(player)\r\n\r\n        -- You can also remove the sword later\r\n        -- Sworduh:Unsword(player)\r\n    end)\r\n```\r\n\r\n### Tracking Kills\r\n\r\nThe `GetKiller` function is useful for creating a kill feed or leaderboard. It returns the last player who damaged another player.\r\n\r\n```lua\r\n    -- In a script that handles character deaths\r\n    local function onCharacterDied(character)\r\n        local deadPlayer = Players:GetPlayerFromCharacter(character)\r\n        if not deadPlayer then return end\r\n\r\n        local killer = Sworduh:GetKiller(deadPlayer)\r\n\r\n        if killer then\r\n            print(killer.Name .. \" defeated \" .. deadPlayer.Name)\r\n            -- Announce or update leaderboards here\r\n        else\r\n            print(deadPlayer.Name .. \" was defeated.\")\r\n        end\r\n    end\r\n\r\n    -- Connect this to all players\r\n    Players.PlayerAdded:Connect(function(player)\r\n        player.CharacterAdded:Connect(function(character)\r\n            local humanoid = character:WaitForChild(\"Humanoid\")\r\n            humanoid.Died:Connect(function()\r\n                onCharacterDied(character)\r\n            end)\r\n        end)\r\n    end)\r\n```\r\n\r\n### Server Cleanup\r\n\r\nIt is important to call the `Cleanup` function when the server shuts down to prevent memory leaks.\r\n\r\n```lua\r\n    local ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\r\n    local Sworduh = require(ReplicatedStorage.Sworduh)\r\n\r\n    game:BindToClose(function()\r\n        Sworduh:Cleanup()\r\n    end)\r\n```\r\n\r\n## Respawn Behavior\r\n\r\nBy default, players automatically recieve a new sword when they respawn.\r\nThis is controlled by the configuration:\r\n\r\n```lua\r\n    local ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\r\n    local Configuration = require(ReplicatedStorage.Sworduh.Configuration)\r\n\r\n    Configuration.CHARACTER.GIVE_SWORD_ON_SPAWN = true -- default\r\n```\r\n\r\nIf you set this to false, players will not recieve a sword on respawn.\r\nYou will need to call Sworduh:Sword(player) again.\r\n\r\nCalling Sworduh:Unsword(player) removes both the current sword,\r\nand the respawn connection for the provided player.\r\nThis means they will no longer auto-recieve a sword again until Sworduh:Sword(player) again.\r\n\r\n**NPCs do not automatically recieve swords on respawn.**\r\n\r\n## Configuration\r\n\r\nRuntime configuration can be found in src/Configuration.luau\r\n","readmeTruncated":false}