Animation not playing

Trying to play animation. Tried the animation on a dummy in which the animation is a valid one.


In the picture, you can see the dummies playing the different animations; but for the player, the animation doesn’t play at all despite print saying it is playing.

Equipping the tool doesn’t play the rest animation despite print statements declaring that there is an AtRest animation and it is supposedly playing.

image

Local Script:

local Player = game.Players.LocalPlayer
local Weapon = script.Parent


Weapon.Equipped:Connect(function()
	local Humanoid = Weapon.Parent.Humanoid
	local AtRest = Humanoid:LoadAnimation(Weapon.AtRest)
	if AtRest then
		AtRest.Priority = Enum.AnimationPriority.Action
		AtRest:Play()
		print(AtRest, AtRest.IsPlaying)
	end
	
end)

Weapon.Unequipped:Connect(function()
end)

Weapon.Activated:Connect(function()
end)
1 Like

some type of animations don’t replicate over clients you need to either play it on the server or from the server fire a remote to signal all clients to play it

I’ve tried a script version. It still has the same issue;
image

local Weapon = script.Parent


Weapon.Equipped:Connect(function()
	local Humanoid = Weapon.Parent.Humanoid
	local Anim = Humanoid.Animator:LoadAnimation(Weapon.AtRest)
	if Anim then
		Anim.Priority = Enum.AnimationPriority.Action
		Anim:Play()
	end

end)

Weapon.Unequipped:Connect(function()
end)

Weapon.Activated:Connect(function()
	local Humanoid = Weapon.Parent.Humanoid
	local Anim = Humanoid.Animator:LoadAnimation(Weapon.Swing)
	if Anim then
		Anim.Priority = Enum.AnimationPriority.Action
		Anim:Play()
	end
end)

does the swing animation play?

No. Same issue for both, on dummies though the animations do play.

try using waitforchild on the animator and humanoid? only other idea I got is the action overwriting each other

Same issue as before, the animation doesn’t play but is detected as playing

Weapon.Equipped:Connect(function()
	local Humanoid = Weapon.Parent:WaitForChild("Humanoid")
	local Anim = Humanoid:WaitForChild("Animator"):LoadAnimation(Weapon.AtRest)
	if Anim then
		Anim.Priority = Enum.AnimationPriority.Action
		Anim:Play()
	end
end)

Weapon.Unequipped:Connect(function()
end)


I can send an example of how I do mine and it works okay

				self.Model.Parent = character;
				local Humanoid = character:WaitForChild("Humanoid");
				local Animator = Humanoid:WaitForChild("Animator");
				
				self.Animation = Animator:LoadAnimation(ModelAssets.Keycard.keycard_hold);
				self.Animation:Play();

Copying what you wrote still led to the same problem on my side:

local Humanoid = Weapon.Parent:FindFirstChildOfClass("Humanoid")
	local Animator = Humanoid:WaitForChild("Animator")
	local Anim = Animator:LoadAnimation(script.Parent.AtRest)
	Anim:Play()
	

Do you do anything in terms of adjusting the properties of the tool or the animations initially? I’m not sure if this is a possibility but I’ve used a weldconstraint to attach the handle to the tool; so perhaps this causes the animation to not play

I don’t use tools I weld the model to the player and play the animation, maybe that has something to do with it? I don’t change the animation priority because when you upload it you can change it that way, though

1 Like

I just got an idea actually, try disabling the script until it’s under the player character

Like enable when loading it? I’m using a datastore and the player gets the tool they equipped for the previous session. I enabled the script like you’ve said, when the tool is being given to the player. Same issue still.

is the animation length greater than 0? maybe you’re cloning a different animation instance than the dummies

The length says 0. I think that’s the issue then. I copied and paste the animation into a prior dummy though and it worked


Length became 1 after unequipping and equipping again.
image

do you have any scripts that play animations other than this? it looks like you’ve got too many animations loaded at the same time on 1 animator

Yes I do. It’s a zombie spawner which it’s like 14-15+ zombies, but turning them off (not having them spawn) still doesn’t fix the issue. I don’t think it’s because of the zombies. Other than that, I don’t have any other animations playing.

ok wait I think I realized, you’ve got the dummies r15 and your character is r6

2 Likes

What do you mean? The original picture shows R6 though.

yeah I realized afterward, I dunno, try go into a live game and see if it’s still broken, it may just be a studio bug? if not try a different animation? im pretty stumped here

1 Like