Help With Tool Equip Animation

sorry i don’t quite understand, how would i do this?

I’m not sure what’s going wrong. Is it too annoying to ask for a rblx file with the relevant scripts in it and I’ll see if I can fix the issue? I’ll give you the solution if I can fix it :slight_smile:

Add an AnimationController to the pipe, with an animator inside. Then in your script you do: “animationController:LoadAnimation(pathtoyourtoolequip)”

1 Like

its fine
Test.rbxl (189.1 KB)

1 Like

I found the problem! It’s a bit complicated so I’m sorry if you don’t understand what I changed fully

Basically when you equip a tool Roblox created a weld to stick the tool to your hand. A weld is like a joint that can’t be animated so there’s the first issue. There’s no joints to animate!

I edited your scripts so when you equip your tool it switches the default weld out for a customizable joint!

Here’s the file, you need to copy the pipe from starter pack and switch it for yours. I also had to change your animation IDs so change those back to yours!

Test.rbxl (189.4 KB)

This does work so if you have any issues then feel free to ask :grin:

2 Likes

Thank you!!! and to those who tried to help thank you very much

1 Like

No problem! I would recommend making your own tool system as you can fully control it, but as you’re new it might be a bit too complicated at this time. Definitely look into it at some point, it’s really useful!

Good luck with your project!

1 Like

hello again!!, if its alright can u explain to me what u did to the code if that’s fine.

1 Like

Yeah that’s fine, I explained a lot of it in my other comment so what is it specifically that you’d like me to explain? Are you trying to add another tool?

the joint/weld thing im trying to add another animation for the attack

You should be able to animate it no problem, as the joint is setup when you equip the tool so there shouldn’t be any issues

1 Like

helloo:)), in the output it says “Infinite yield possible on ‘Workspace.mynamesemidouble.Right Arm:WaitForChild(“Right Grip”)’” what does this mean? and it wont play the animation once i added the weld script it was fine until i added it

An “infinite yield” warning means that a :WaitForChild() is searching for something that isn’t there. This might be due to the fact that the “RightGrip” weld that’s created when a tool is equipped doesn’t have a space in it.

local function OnEquipped()
	local weld = arm:WaitForChild("RightGrip", 1)

	local joint = script.Handle
	joint.Part0 = weld.Part0
	joint.Part1 = weld.Part1
	joint.Enabled = true
	
	if weld then
		weld:Destroy()
	end
	
	Tracks[1]:Play()
end

By the way I improved this function slightly so copy this into your equip script :slight_smile:

This function is the one I edited. When the function is run by equipping the tool it looks in the right arm for the “RightGrip” weld that a tool created when equipping. The 1 will make sure the script doesn’t infinitely yield if it doesn’t find the weld by timing out the :WaitForChild() function.

	local weld = arm:WaitForChild("RightGrip", 1)

This chunk of code sets up the “Handle” joint in the script. Part0 is the part it’s being joined to and Part1 would be the pipe.

	local joint = script.Handle
	joint.Part0 = weld.Part0
	joint.Part1 = weld.Part1
	joint.Enabled = true

You should be able to play any animation when the tools equipped as this joint is setup every time you equip the tool. Just check to see if the tool is equipped and then run whatever code you need for your animation.

Sorry if this seems a bit rushed, I have to get ready for church so I don’t have much time haha.

1 Like

alright thank you again i’ll try it later, hehe sorry for disturbing you

1 Like

No that’s fine :slight_smile:
I don’t think there’s anything else I need to mention but if you have more questions maybe DM them to me?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.