Animation not playing inside of character added event?

Hey, so I’m trying to get an animation to play inside of a character added event but its doing everything BUT playing the animation on the characters humanoid, im not sure why…

Code

player.CharacterAdded:Connect(function(character)
	camera.CameraType = Enum.CameraType.Custom
	camera.CameraSubject = character.Humanoid
	character.Humanoid.WalkSpeed = 0
	Mechanic.Enabled = false

	local animation = character:WaitForChild("Humanoid").Animator:LoadAnimation(game.ReplicatedStorage.BlockStart)
	animation:Play()
end)
  • Try print debugging?
  • is the Animation’s speed set to 0?
  • are there any other parts of the script / other scripts pausing or stopping it?
  • animation priority?

So basically everything else before it is working because it is surely disabling the mechanic and setting my characters walkspeed to 0, also I have tried prints and yes it does print before and after it

What about animation priority? Are you sure you set the animation’s priority to a reasonably high setting?
Alternatively, try running the animation on its own.

Yes the animation is already the highest priority, what do you mean running the animation on its own?

So basically I am loading the character on the server and like so I had a problem where like it wouldnt instantly do everything I wanted ex. placing the character on a block and also playing that block start animation but now I finally got it to work using the character added event but the problem is that now the block stastr animation doenst want to work

Nevermind, it’s already “on its own” i guess. Perhaps the AnimationID is incorrect? I’m assuming there are no errors too. Other than that, I’m all out of ideas.

1 Like

Nope the animation ID isnt incorrect either Ive tried firing from the server when the player first joins and it works perfectly, its just not working when I load the character the second time well because I think it just hasnt had enough time to load yet, well damn man thanks I appreciate the effort

@ValtryekRBLX OKAY SO I FIGURED IT OUT

so basically I just had to literally add a task.wait() :joy:

player.CharacterAdded:Connect(function(character)
	camera.CameraType = Enum.CameraType.Custom
	camera.CameraSubject = character.Humanoid
	character.Humanoid.WalkSpeed = 0
	Mechanic.Enabled = false
	
	task.wait()
	local animation = character:WaitForChild("Humanoid").Animator:LoadAnimation(game.ReplicatedStorage.BlockStart)
	animation:Play()
end)
1 Like

Nice!

Summary

This text will be hidden

1 Like

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