You can use the TargetKilled event to add to a cash stat:
local statName = "Cash"; -- name of your leader stats
local amount = 250; -- amount of cash given to a player
sword:OnTargetKilled(function()
sword:GetOwner():WaitForChild("leaderstats")[statName].Value += amount;
end);
I got 1 question how do we disable the preset hitboxes and add our own? Also you should do a more in depth documentation (especially on all the settings) as this has some elements that are pretty hard to understand
The best way to do that would be to put a bool value into the character of the person hit, and when they are hit search if the bool is true (or false) alternatively you could add an attribute to the humanoid or the character (this could be a string or another bool value) and search for the person hit.
This will be a feature of the next Sword Smith module I’m currently in the process of making right now, the current version is incapable of doing this. However, since this option isn’t currently available, it’s worth a shot to check out Raycast Hitbox, a free resource that allows you to create hitboxes very similar to those found in Sword Smith.
You are a very good person for doing this! Thank you so much for this amazing module, I got couple of suggestions first one blocking dmg etc the second one I would recommend you do a more in depth tutorial on what all of the different settings do etc!
I Know its a little old but im struggling to get the animtions to work everything else works great just wont play my animation
local ServerStorage = game:GetService("ServerStorage")
local SwordSmith = require(ServerStorage:WaitForChild("SwordSmith"))
local tool = script.Parent
local debounce = false
local data = {swingAnims={8358215765},
knockBackEnabled = true,
knockBackStrength = 50,
criticalHits = 5, --How much damage is dealt to the target on a critical hit
criticalInterval = 1,
currentDamage = 2,
}
local sword = SwordSmith.new(tool, data)
tool.Activated:Connect(function()
if debounce then
return
end
debounce = true
sword:Swing()
end);
sword:OnSwingEnded(function()
--You can of course add extra delay if you have a short swing animation
debounce = false
end)
local data = {
swingAnims = { --For swords compatable with both rig-types
R6 = {00000},
R15 = {00000}
},
holdAnims = { --List of animations played in sequence when sword is equipped
0000,
0000,
}
killsStat = {
StatName = "Kills"
},
Trail = false, --The automatically generated trails are quite-buggy, so creating your own may be a good choice
ignoreList = {game.Players.Arc_Cosine.Character}, --Characters of people who are uneffected by the sword
killPlayers = false --If you only want the sword to kill NPCs, set this to false
}