This video will show you
how to make a sword on Roblox.
Insert parts using the part button
and design your sword to your liking.
We're going to design a simple sword
using parts and wedge parts.
Once you've finished creating your sword,
insert a part and name it Handle.
Make sure it has a capital H
and scale the part down to be small.
Move your handle to where you want the player
to hold your sword.
Now select all of your parts
and ensure that the anchored property is set to unchecked.
Click on the plus icon in the workspace
and insert a tool object.
Select your parts and drag them into the tool.
Again, make sure that the handle part
is spelled correctly and has a capital H,
otherwise the tool will not work.
Now we need to weld all of the parts together
so that the sword doesn't fall apart.
Click the plus icon on the handle
and insert a WeldConstraint.
Set the Part0 property to the handle
and set the Part1 property to one of the other parts.
Repeat this step until you've set up WeldConstraints
which connect the handle to every other part.
Make sure Part0 is the handle on every weld.
Now ensure that your sword is the correct size
relative to a Roblox character.
You can do this by inserting an NPC character
via the plugins, rig builder menu,
or by inserting an NPC from the toolbox.
Change the size of your sword
by selecting the tool object,
then by selecting the scale tool.
Name your sword by selecting the tool
and changing the name property in the properties panel.
Drag the sword into the starter pack
and then click the play button.
Select your sword in the toolbar to equip it.
If your sword is not rotated correctly,
close the test session, select the handle again,
and then press control + R, or command + R on Mac,
to rotate by 90 degrees.
Now that we've created our sword,
we can script it to kill other players.
Insert a script into the tool.
Inside this script, we are writing code to kill the player.
We detect when the sword touches another object,
check to make sure it's a player or NPC,
and if so, we deduct health from their humanoid,
which will kill them.
We also add their character
to a debounce table for two seconds
to ensure that there's a cooldown for the script.
You can find this code
by going to the link in the description.
Select a part and duplicate it.
Then use the scale tool
to make it cover the area of the sword which we don't hold.
This will be the part which detects touches
from players that the sword hits.
Set the transparency of the hitbox to 1,
and then duplicate a WeldConstraint in the handle
and set the Part1 to the hitbox.
You can test your sword by inserting an NPC into the game
via the toolbox or rig builder.
Then walk up to the NPC and touch the sword against it.
The NPC should be killed.
Now you can go back to select your handle
and set its transparency to 1.