Animating a tool

Basically, i am making a tool and i need an animation to play when it is activated, i’ve tried this before but it didn’t quite work so can anyone tell me how i can do it please?

I am not asking for full scripts, just teaching me how to make it would help.

2 Likes

If you want an animation to play when the tool is activated then you need to check for the player’s character. Checking it in local script is pretty easy something along this should work.

-- Local script

local Player = game.Players.LocalPlayer -- Get local player
local Animation = script.Parent.Animation -- An Animation

script.Parent.Activated:Connect(function()
	if Player.Character and Player.Character:FindFirstChild("Humanoid") then -- Check if character exist and humanoid within character exist.
		Player.Character.Humanoid:LoadAnimation(Animation):Play() -- Loads an Animation onto a Humanoid then plays it.
	end
end)
3 Likes

If i use the localscript will all the players see the animation?

2 Likes

LoadAnimation is deprecated.

2 Likes

Ooo… That’s new, thank you for letting me know about it. :slight_smile:

2 Likes

Any players will be able to see the animations even if it is played from client.

1 Like

So for the alternative of LoadAnimation, that is now deprecated, what should i use instead?

1 Like

So Humanoid.Animator:LoadAnimation(animation) ?

Also, should the animation be set to “Action”?

1 Like

I’m not sure about the new Animator thingy yet. I suggest your animation priority should be set to Movement if you want make an idle animation, Action is mostly used for attacking animation such as swinging a sword.

Yes, i am using as an attack animation.

Then Action should suits it best.

1 Like