Have you ever animated a sword swing or slash and your first instinct is to parent your tool to your character?
You find out the character doesn’t automatically equip it in game…
You might already know about console and you try to input:
It doesn’t error, but it didn’t equip the tool… Even if you run this function while the game is running on a non-player character, it still doesn’t work!
A common workaround is to:
- Start the game
- Equip the sword yourself
- Copy you character with the tool now equipped
- Stop the game
- Paste your new character with the tool equipped
- Animate your character
But what if you’re trying to create a character creation screen?
What if you have multiple tools you need to create different animations for?
Why isn’t as easy as parenting a tool to a default character with a humanoid?
Roblox is lacking in many regards when it comes to creating custom characters. HumanoidDescription is relatively new, it took about 15 years to get something like that. But today, I have a simple trick for you to use.
All you have to do is Weld the tool.
local tool = workspace["Linked Sword"] local character = workspace.Dummy local weld = Instance.new("Weld") weld.C0 = character.RightHand.RightGripAttachment.CFrame weld.C1 = tool.Grip weld.Part0 = character.RightHand weld.Part1 = tool.Handle weld.Parent = tool
Take this code, point the tool and character variables to whatever you’re using, and watch as the tool flies to the character’s right hand. If you plan to reuse the same tool, be sure to delete the weld instance if you don’t need it.
You can run this code in a script or run it in the console.
If you want to equip the tool in the left hand, simply replace the weld.C0 and weld.Part0:
weld.C0 = character.LeftHand.LeftGripAttachment.CFrame weld.Part0 = character.LeftHand
The same concept works with accessories in general.
Instead, set the
tool variable as the accessory, set
weld.C0 to the corresponding body part’s accessory
weld.C1 as the accessory’s
AttachmentPoint, and set
weld.Part0 to the accessory’s body part like so:
local tool = workspace["Valkyrie Helm"] local character = workspace.Dummy local weld = Instance.new("Weld") weld.C0 = character.Head.HatAttachment.CFrame weld.C1 = tool.AttachmentPoint weld.Part0 = character.Head weld.Part1 = tool.Handle weld.Parent = tool
Of course you can rename
tool to accessory or whatever you’d like.
The concept works if you want to attach anything to a character, as long as you have an attachment.
Drop a like if this helped. Leave a reply if you have questions about animating tools, I’ll try my best to help when I see it.