Animation not working

You can write your topic however you like, but you must answer the following questions:

  1. What do you want to achieve?
    play the animation

  2. What’s the problem?
    the animation will not play, but the result prints the text

  3. What solutions have you tried so far that work?
    he tried to republish the animation twice

local Player = game.Players.LocalPlayer
local PlayerCharacter = Player.Character

local Humanoid = PlayerCharacter:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")

local PreLoadedAnimations = game.ReplicatedStorage.Animations
local Animations = {
	Rock_Chop = Animator:LoadAnimation(PreLoadedAnimations.TheRockChop)
}

local Tool = script.Parent
local Axe_sound = Tool.Handle.Axe

local Events = game.ReplicatedStorage.RemoteEvents

local Activated = false

Tool.Activated:Connect(function()
	if not Activated then
		Activated = true
		Animations.Rock_Chop:Play()
		Axe_sound:Play()
		
		Axe_sound.Ended:Connect(function()
			Activated = false
		end)
	end
end)

I don`t know why its no working. Animation and Game is Published to same group.

2 Likes

Try this out.

--You'll first need to define a humanoid if you haven't already

Tool.Activated:Connect(function()
	if not Activated then
		Activated = true
                
        local Track = Humanoid:WaitForChild("Animator"):LoadAnimation(--[[Animation goes here]]) 

		Animations.Rock_Chop:Play()  --You'd play the track here using `Track:Play()` instead of 
		Axe_sound:Play()
		
		Axe_sound.Ended:Connect(function()
			Activated = false
		end)
	end
end)

For future reference note that you have to create an animation track to play the animation you’ve made. Not only that but you can also use the animation track to stop, and adjust the speed of your animation.

You forgot to load the animation.

Its still not working.

The Animation is Loaded by Animator in Animations Table.

Do you mean Track:Play() instead of Animations.Rock_Chop:Play()

I had that in the comments next to the line.

But I replaced Rock_Chop:Play() with Track:Play().
And it still doesn’t work.

I’m not that stupid
-_-

Didn’t see that, sorry for the misread.

Maybe it’s an issue with

Tool.Activated:Connect(function()
	if not Activated then
		Activated = true
		Animations.Rock_Chop:Play()
		Axe_sound:Play()
		
		Axe_sound.Ended:Connect(function()
			Activated = false
		end)
	end
end)

Try substituting the if not Activated then With if Activated == false

be sure that it is on character scripts so it can execute

Try this :

Animations["Rock_Chop"]:Play()

legit script(my own) :

local ahh = game.ReplicatedStorage.Animations

script.Parent.Activated:Connect(function()
	
local hum = script.Parent.Parent:WaitForChild("Humanoid")

local Animations = {
		aha = hum:LoadAnimation(ahh.Animation)
	}
	
Animations["aha"]:Play()
	
end)
if Activated == false then

should work

Activated == false
Activated ~= true
not Activated

Its all the same…

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