Tool Animation not animating correctly

Working on a pretty simple sword swing animation, I’ve actually done this a few times in the past but I’ve been away from studio for a few months and can’t figure out how to do it the same ways as last time, even after looking at my code from then. Doesn’t look like anyone had a similar problem from my searching, either.

Anyways, the problem is that the sword doesn’t fully rotate… Before it wouldn’t rotate at all but i fixed that problem. Now it just doesn’t look the way the intended animation looks, here’s a comparison of the original, intended animation, and my almost working sword swing.

My goal is to make the sword rotate all the way through, just like it shows in the original animation, the first video.

For some reason the sword won’t follow through with the swing? I think the issue might be related to the way I attached the sword to the character, but I’m not quite sure what to change. Most changes I make to the function will stop the sword from rotating at all during the animation, and then it just looks like a really awkward punch. So I’m not 100% sure on it. Here’s the script where I do the attachment.


-- Functions
local function AttachSword(CHAR, HRP, Torso, RightArm) -- Attaches sword to character.
	local SwordClone = Meshes.LinkedSword:Clone() SwordClone.Parent = CHAR
	local PrimaryPart = SwordClone:WaitForChild("Hinge")
	PrimaryPart.CFrame = (RightArm.CFrame *, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-90), math.rad(0)))
	local Weld ="Motor6D"); Weld.Name = "Hinge"; Weld.Part0 = RightArm; Weld.Part1 = PrimaryPart; Weld.C0 = Weld.Part0.CFrame:ToObjectSpace(Weld.Part1.CFrame);
	Weld.Parent = RightArm;

-- Events
		local HRP = CHAR:WaitForChild("HumanoidRootPart")
		local Torso = CHAR:WaitForChild("Torso")
		local RightArm = CHAR:WaitForChild("Right Arm")
		AttachSword(CHAR, HRP, Torso, RightArm)

Let me know if you have something! I feel like I’m overthinking this and can’t see an obvious solution lol. :happy1:

I think the issue is that it’s welded to the arm, not attached.
From my experience with welds and attachments, I’ve seen that if you weld an object, in order to move the object you welded you have to move the thing you welded it to, you can’t move the object by itself.
With attachments the object can move without needing to move the thing you attached it to and the object also moves when you move what you attached it to.

I don’t know much about welds, attachments and tools in general. I learned this from editing rigs and animating them but it might also work with tools since there’s also animation involved.

Yes, the sword is welded to a tiny cube that is rotated in the animation, not the arm on its own. And sorry for the confusion, there are no actual attachments being used in the tool or script, just welds. The sword is rotating, but it doesn’t rotate how the original animation does. It kinda just gets halfway there and calls it a day.

If it’s welded to the tiny cube and, I guess that the tiny cube is welded to the arm, try using attachments.
I think what’s happening is that in the animation you rotate the arm and the sword (or tiny cube) separately, but because it’s welded the sword rotates as much as the arm does and doesn’t rotate how you animated it.

Okay, I’ve been trying your method but I can’t really see any way i can make this work with attachments. I’m sure it would work if i manually animated it myself inside a script, but I plan on making a lot more animations, and I really don’t want to have to do that over and over. I know there’s a better solution, or a fix to my problem, but I can’t figure it out.

1 Like

If it isn’t fixed by swapping the Weld with an Attachment then I can’t really help any more, sorry.

1 Like

All good, thanks for the idea though :happy1: I’ll keep trying to find my own fix or work around! :wink:

1 Like

okay the solution was obvious, i totally forgot to overwrite the original animation with the fixed one. :uhh:

How did you fix it though? Stuck with the same issue.

honestly it was me just being silly and forgetting to update my old animation with the new working one, so i guess i just changed the animation!

I recently found out why my tool wasn’t move/rotating in game like in my animation. Turns out you need to make your own Motor6Ds in order for the tool to get animated too.

oh yeah, its a pain at first but quickly gets easy and fun! good job figuring it out! good luck with your project!

1 Like