Animation does not work

  1. What do you want to achieve? Keep it simple and clear!

Make an animation play when I activate the tool

  1. What is the issue? Include screenshots / videos if possible!

My animation just doesn’t work at all

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have sheached for over 1 hour but has came with no result in my current problem

Here is the script used to play the animation

script.Parent.Activated:Connect(function()
	local animation = script.Animation
	local humanoid = script.Parent.Parent.Humanoid

	local animationtrack = humanoid:LoadAnimation(animation)
	animationtrack:Play()
end)

Here is inside the tool if needed

3 Likes

Any errors?; if so please tell me them. If not try checking the AnimationId and ensuring its a valid asset. Example: ‘rbxassetid://’…123456789

1 Like

Theres no error in the output and the AnimationId exact

Try this:

script.Parent.Activated:Connect(function()
    print('Connection is running')
	local animation = script.Animation
	local humanoid = script.Parent.Parent.Humanoid

	local animationtrack = humanoid:LoadAnimation(animation)
	animationtrack:Play()
    print('animationtrack played')
end) 

try this code, tell me what it prints. (The prints should tell you what’s working or not)

It prints both information in the output

Is it possible the animation priority is not high enough to override?

It might be the case, the only problem is that I do not know how to change it

script.Parent.Activated:Connect(function()
	local animation = script.Animation
	local humanoid = script.Parent.Parent.Humanoid

	local animationtrack = humanoid:LoadAnimation(animation)
    animationtrack.Priority = Enum.AnimationPriority.Action4
	animationtrack:Play()
end)

It works! Thanks for the help!

1 Like

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