Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My equipping animation for my axe does not work?

I have made an animation where you pull out an axe it will do the animation. But it doesn't work?

There is no error in the output either

local player = game:GetService("Players").LocalPlayer
local character = player.Character
local animation =script.Parent:FindFirstChild("Animation")
local Anim = character.Humanoid:LoadAnimation(animation)

script.Parent.Equipped:Connect(function()
	Anim:Play()
end)

Workspace

Animation ID is set as well Animation was made in animation editor and is an Action

2 comments

0

is this a local script or a script? (btw we can't see the image you sent because reasons)

0

You should be using Humanoid.Animator:LoadAnimation() not Humanoid:LoadAnimation as it's deprecated.

2 answers

try implementing a local function such as:

local function equip()

then try:

AXE.Equipped:Connect(equip) -- insert name of axe to replace AXE
     Anim:Play()

or something along the lines

8 comments

0

What do i put in the equip() function when im putting it in the AXE.Equipped thing?

0

local function equip() Anim:Play() end script.Parent.Parent.Equipped:Connect(equip())

0

no so basically you need to intergrate it into your script, ill try and see if i can do it quickly now

0

also where is this script located?

0

Its a local scriot under the handle in the tool i think, click on the workspace link i provided

0

for the best possible understanding, try read this article: https://devforum.roblox.com/t/how-do-i-make-a-custom-weapon-equip-animation-script/1273073/14 if you still dont understand or cant do it, just comment and ill give you a script for it.

0

ok so i looked at tthat forum post and i've gotten this out script out of it but its still doesnt work, there is no error either the animation i want to play doesn't play

0

local knife = script.Parent -- here we got the knife tool local pla = game.Players.LocalPlayer --here we got the player local cha = pla.CharacterAdded:Wait() --here we got the character from the player local hum = cha:WaitForChild("Humanoid") --here we got the humanoid from the character local animation = Instance.new("Animation") --here we create a new animation animation.Parent = script.Parent

It might be because its trying to go at the same time as the tool equipt animation so try this also LocalPlayer and Local scripts don't really work with tools so maybe this will help

--regular script
local player
--we dont need this character variable
local animation =script.Parent:FindFirstChild("Animation")
local Anim

script.Parent.Equipped:Connect(function()
player = script.Parent.Parent
Anim = player.Humanoid:LoadAnimation(animation)
wait(2) --adjust the 2 to your liking, but don't let it go too low
    Anim:Play()
end)

hope this helped!

1 comment

0

The animation doesn't work with this

This discussion is preserved as it was. New answers, comments, and votes are closed.