Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My equipping animation for my axe does not work?

Asked by 2 years ago

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

0
is this a local script or a script? (btw we can't see the image you sent because reasons) NGC4637 602 — 2y
0
You should be using Humanoid.Animator:LoadAnimation() not Humanoid:LoadAnimation as it's deprecated. pwx 1581 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago

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

0
What do i put in the equip() function when im putting it in the AXE.Equipped thing? Sonnymacko 19 — 2y
0
local function equip() Anim:Play() end script.Parent.Parent.Equipped:Connect(equip()) Sonnymacko 19 — 2y
0
no so basically you need to intergrate it into your script, ill try and see if i can do it quickly now Helloimpets 17 — 2y
0
also where is this script located? Helloimpets 17 — 2y
View all comments (4 more)
0
Its a local scriot under the handle in the tool i think, click on the workspace link i provided Sonnymacko 19 — 2y
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. Helloimpets 17 — 2y
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 Sonnymacko 19 — 2y
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 Sonnymacko 19 — 2y
Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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!

0
The animation doesn't work with this Sonnymacko 19 — 2y

Answer this question