How to animate Tool Handles easily! [OLD POST]

Works. Now to the cooldown. T H A N K Y O U :))))

1 Like

Also, to add a cooldown, make a debounce. At the very top of the Script that you load your animations in, make a variable called “debounce”. here’s an example of what it should look like.

local debounce = false

Then inside of your script, under the Activated function, put this at the top of the script. I’ll paste it here so you don’t write something incorrectly.

local debounce = false

script.Parent.Equipped:Connect(function()
	
	IdleRest = script.Parent.Parent.Humanoid:WaitForChild("Animator"):LoadAnimation(game.ServerStorage.Animation)
	SwingAnimation = script.Parent.Parent.Humanoid:WaitForChild("Animator"):LoadAnimation(game.ServerStorage.SwingAnimation)


	IdleRest:Play()
-- Do not play the Swings animation here. You put that in the Activated function.
end)

script.Parent.Unequipped:Connect(function()
IdleRest:Stop()
SwingAnimation:Stop()
end)

-- THIS IS WHERE YOU ADD YOUR COOLDOWN!

script.Parent.Activated:Connect(function()
if not debounce then
   debounce = true
   SwingAnimation:Play()

   wait(3) -- Change this to the desired time until you can swing it again
   debounce = false
end
   
end)
3 Likes

I hope this helps. Do let me know of any future issues.

2 Likes

Thanks, it all works. Hope you make more tutorials in the future.

I certainly will do my best to make more tutorials in the future. If you have any ideas, please let me know, and stay safe.

2 Likes

Adding onto this, if you don’t want to have the full-body animate, and you just want the idle animation to have the weapon in the right place (or you want the knife to work with an animation pack you’ve already made and don’t want to remake it), simply create an animation, with the only keyframe being the handle. Adjust the keyframe how you’d like, and follow the script that was given and it should work.

Great tutorial, it’s helped me a lot.

4 Likes

This is a really good fix, and kinda flew by me ngl. Glad you got it here in time! Not many have seen this yet, but still quite a few. Please use this method if you don’t want the issue with your Core Animations and such.

3 Likes

I got a question, how do you make it so I can do, lets say, 2 swings instead of only 1 swing?

It depends on what you’re trying to achieve. If your trying to make it so when you click it plays an animation, then another, or when you click it plays an animation, then after you click again the animation is different.

I’d have to look into this a little more, but when I do figure it out I’ll let you know.

1 Like

Yes, that concept. I would like to see it and use it if it’s ok with you?

Edit: Like, just a test place for me to try it out ofcourse.

1 Like

If you’re going to, just make sure to give out the script because I don’t think you can just ask someone for the script on the developer forum so yeah this is a tutorial page so anything regarding should be released for learning purposes. I recommend you also get into scripting a bit more so you don’t run into these issues. Tons of great tutorials out there. Some good youtubers would be:

  • TheDevKing (awesome guy, learning from him primarily)
  • AlvinBlox (not all that straight forward IMO, but still has really good tutorials)
  • Sheasu (he made a beginner introduction video that got me into scripting, it was severely helpful.
3 Likes

It’s not that I don’t know how to script, it’s just that the concept of putting the “Stuff” together in a script thats hard. I know my variables, functions etc, just don’t know how to do it, no one explains it, they just go you do this, that so on.

Makes sense. I wasn’t saying you knew absolutely nothing, I was just saying those guys can help you learn better, so you can learn how to put the things together. There will be gaps when it comes to scripting and you’ll have to stitch it together :+1:

2 Likes

Thanks, Ima look on the internet for some more information.

Those YouTubers I listed will assist with patching the gaps further. I sure don’t know everything, I find myself not knowing how to do something, but then pulling what I know, experimenting, and I eventually get to a solid product. That’s basically how I pulled this whole tutorial together :slight_smile:

Edit: I’ll update this tutorial in the future with other customizable things with a separate post, that uses a variety of different scripts when possible.

2 Likes

That works too, but I might as well just extend this tutorial with the excess features that you can do with it regardless. Thanks though! I’ll exclude your part from it so there isn’t a duped tutorial.

2 Likes

Do what you may, not stopping you from doing anything. If it’s more easier, I can just put the script you put here in the extended tutorial, and credit you.

2 Likes

What if I wan’t the weapon to be connect to the left arm instead of the right arm? I did everything you said, but with the left arm. It seemed to work at first, but when I wanted to test it, it didn’t work, I even changed some code in the Motor6DHandler to LeftArm instead of RightArm and so on. Can you help me on this?

I believe the Tool has to be Welded/Motor6D’d to the Right Arm (or RightHand) at all times. I’m going to test this one right now, and see if I run into any issues. If it works with the Right Arm (or RightHand) and it doesn’t with the left, then it’s probably because of this reason.

2 Likes

Ok, thanks. You deserve a follow tbh.

1 Like