Skinned mesh tools animation

This evening i figured out how to make a Tools for skinned mesh
i’ve tried to make an animation for the tool when equipped but it doesn’t work

Here is my local script i added to the tool

local Tool = script.Parent
local Anim = script.Animation
Tool.Equipped:Connect(function(Eq)
	local Character = game.Players.LocalPlayer.Character
	local Anim = Character:FindFirstChild("Humanoid"):LoadAnimation(Anim)
	Anim:Play()


Tool.Unequipped:Connect(function(Un)
	Anim:Stop()
	end)
end)


This is what happens

Is the animation object parented to the localscript?

1 Like

The animation is a child for the local script

Try using WaitForChild(), especially if you’re trying to access something that the player is loading in.

1 Like
local Tool = script.Parent
local Anim = script:FindFirstChild("Animation")
Tool.Equipped:Connect(function(Eq)
	local Character = game.Players.LocalPlayer.Character
	local Anim = Character:FindFirstChild("Humanoid"):LoadAnimation(Anim)
	Anim:Play()


Tool.Unequipped:Connect(function(Un)
	Anim:Stop()
	end)
end)

WaitForChild Not FindFirstChild
WaitForChild waits until the object exists, like a promise.

2 Likes

Thank you bro i didnt focus on WaitForChild but it worked very well now

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