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

The animation I made does not work?

So I tried making animation and tried to make it work using this script (Animation named Attack is inside this local script which is inside a tool)

tool = script.Parent
tool.Equipped:connect(function(mouse)
	local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
	attack:Play()
end)

and it won't seem to play the animation, I just uploaded the animation tens of minutes ago, does that have something to do with it?

6 comments

0

I will try to help you a second.

0

It works on animation builder but I can't seem to make it work with my tool hmm

0

I will help you just let me get my studio up.

0

Try using localplayer and player.Character.humanoid instead.

0

still doesn't work T_T

0

I tried everything, maybe it's my animation that's the problem? But it plays when I play it on the editor hmm

1 answer

Chances are your priority of the attack it too low so Roblox's animation plays over it.

#Solution:# Open up the editor, load into animation through exports (so import) it. Then you wanna press on Settings. There will be an option to change the animation Priority, click Priority and make sure the priority is "action". After re-export is and since the animation Id stays the same, it should work!

#Code:# Since there is no real problem with the script I'm gonna improve it for you:

local tool = script.Parent -- use local variables
tool.Equipped:Connect(function(mouse) -- :Connect not :connect, :connect is deprecated
    local attack = tool.Parent.Humanoid:LoadAnimation(script.Attack) -- script.Parent is tool so just use tool.Parent
    attack:Play()
end)

Hoped this helped!

2 comments

0

I already set the priority to action but ill try it again now thanks!

0

Still doesn't work :( Set priority to action and tried the script inside the tool, still does nothing on equip hmmm

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