Sword Smith | Script Swords in Just Minutes! [FREE]

If your question is whether or not it can damage an NPC, then yes. Anything caught within the swing that has a humanoid will be damaged. You can also make it so only damage NPCs.

local data = {
	killPlayers = false,
}

However if your question was whether or not an NPC can use the tool. That is completely up to you. Sword Smith does not making artificial intelligence or path finding NPCs. It would be up to you to create something that path finds to a specific target and swing from a certain distance.

2 Likes

I mean can the npc hold the weapon like how a player would and do the things a player would. I’m not asking if the npc can path find and stuff, I just want to ask if it could do that

1 Like

I just did a little bit of testing, and it seems that the module is currently only compatible with player instances using it, however (if your really need it) I can add NPC support today, might just take a little while.

2 Likes

@DeathLilian, just wanted to let you know the new update is out, you can get the next version by deleting the Sword Smith module in your game and just adding it back through the toolbox. This update should’ve fixed your problem. Please let me know if you’re still having problem though, I’d be happy to help.

3 Likes

Oh okay ty also are you planning to make blaster or gun module like this?
I just got idea for blaster module to be work with npc and able to deflect the blaster bolt or bullet with lightsaber blades or shield.

1 Like

Not really sure about creating a blaster module, as I’m not really the best with making guns or any type of projectile weapons. However if you’re looking for a good module that can create guns with ease, I suggest looking at some of the resources below:

However the deflection may be something I’m capable of doing, with the blocking system. I’m currently working on an update to celebrate 1k views on this post, I’ll consider adding a blocking/deflecting system.

3 Likes

Update

I figured that since I quite regularly update Sword Smith, it was about time to make something that automatically updates it. And surprisingly this didn’t take that long. This’ll be a huge help especially since I plan on updating a lot basically all week to celebrate 1k views on this post. The auto-migrator that I’ve just added will make it so even when there’s a new update, you don’t have to migrate to the next update manually. The module now migrates on it’s own.

For those of you who may not find this to be clear. Sword Smith is a free model, when you place it in your game it cannot be changed by anybody but you and your game developing partners. This means that whenever I release a new update, you can’t use it until you’ve migrated to the next update.

Migrating is pretty simple, all you have to do is delete the module from your game and add it back in using the toolbox. This however can become a pain since I quite regularly update the module. This will be the last migration that you will ever have to do because of this small snippet of code I added this afternoon (depending on your time zone):

if script.Parent:GetFullName() ~= "Model" then
		print([[
			SwordSmith is now loading!
		]]);
		local currentVersion = 
			{
				high = sword._VERSION:match'%d+',
				low =({ sword._VERSION:gsub('%d+%.','') })[1],
			};
		
		local newAssetid = 6946292010;
		local alternateModel = require(InsertService:LoadAsset(newAssetid):WaitForChild("SwordSmith"));
		alternateModel._DOINIT = false;
		
		local alternateVersion = 
			{
				high = alternateModel._VERSION:match'%d+',
				low = ({ alternateModel._VERSION:gsub('%d+%.','') })[1],
			};
		
		local migrateTo =
			{
				tonumber(currentVersion.high) < tonumber(alternateVersion.high),
				tonumber(currentVersion.low) < tonumber(alternateVersion.low),
			}; for _, bool in pairs(migrateTo) do
			if bool then
				return alternateModel;
			end;
		end;
	end

To get this migration update you don’t need to do anything, but migrate one last time. No other action is required. Enjoy.

I would like to note that I will soon be creating a lot of updates to Sword Smith to boost performance, customizability, and more to celebrate 1k views on this post (and maybe 100 sales?) Make sure to stay tuned all week, because there will be atleast one update a day, some of these include:


I’d like to give a big thanks to @foundanerror for helping me with this new auto-migration update!

6 Likes

Hi
I’m trying this out but I can’t get an animation to play. Here’s my code:

local ServerStorage = game:GetService("ServerStorage")
local SwordSmith = require(ServerStorage:WaitForChild("SwordSmith"))

local tool = script.Parent
local debounce = false
local data = {swingAnims={6947086383}}

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)

There are no errors, the animation just doesn’t play. I used the ID from your post.

1 Like

Sadly you can only use animations you make yourself on roblox. If you’re having trouble making an animation I suggest you watch this video for help.

2 Likes

As I am kind of a Roblox bladesmith, I will certainly give this a try!

2 Likes

I love this module! I have one question, How can I determine how much damage I want the sword to do?

1 Like

When you create the data table for your sword you can use the currentDamage property, which by default is about 25 I believe.

local data = {
	...,--Other necessary properties
	currentDamage = 45,
};
2 Likes

Wow it’s my own module, can’t believe I forgot this. When you call the :Swing method there’s a damage and ignore list property. Probably more efficient to do it this way.

local Damage = 45;

sword:Swing(Damage);
2 Likes

Update v1.1: Better Hitboxes

(Update 1/7 for 1k views celebration :partying_face:)

Something that’s been bothering me ever since the release of Sword Smith was the fact hit boxes were only adjoined to the handle. This could potentially create inaccuracies in the hitboxes for swords containing multiple parts. If the handle is only a fraction of the size of a whole sword model, then only a fraction of the sword can damage people.

This new update creates a “fake handle” in swords containing multiple parts and creates nodes inside of this part to ensure accuracy. As I had mentioned in my last update, you no longer need to update Sword Smith, it now updates itself automatically. To enable this better hitboxes feature no action is required, more accurate hitboxes will be created automatically once the sword class has been created.

5 Likes

I have found a bug when you unequip the sword the holding animation still plays.

2 Likes

If I had to be honest I rushed the holding animations feature a bit, thanks for the report. I’ll work for some time to get them up to speed with the swinging animations.

2 Likes

I think the issue is fixed, let me know if you’re still having problems. I’d be happy to help!

2 Likes

Update v1.12: Critical Hits

(Update 2/7 for 1k views celebration :partying_face:)

I’ll be updating Sword Smith all week long so stay tuned for more updates. Today I decided to get the critical hits update out of the way. It’s simple but it makes for a good combat system. I’ve been playing around with stylizing dev forum posts. Let me know if you like it because I might consider re-writing the main post.

Critical Hits

A critical hit is when you swing your sword multiple times and then one of those swings causes more damage. Which is why it’s called a critical hit, it’s a hit that packs more of a punch. Through use of the data table, it’s possible to create critical hits.

local data = {
	criticalHits = 45, --How much damage is dealt to the target on a critical hit
	criticalInterval = 3, --How many swings it takes until a critical hit happens
}

All information above can be found in the Basic Usage category.

2 Likes

You could also add a optional critical hit swing animation.

1 Like

I think it’s great! The idea is a great work!

1 Like