How to do animation events for a walk animation on npc in workspace

Im using this for like a stomping sound eveytime the thing walks or takes a step

I have a serverscript in the npc and it is this:

script.Parent.Animate.walk.RunAnim:GetMarkerReachedSignal("LeftFoot"):Connect(function()
	print("okaadass")
end)

i get this error:
GetMarkerReachedSignal is not a valid member of Animation “Workspace.Bandit.Animate.walk.RunAnim”

How can i make this work?

GetMarkerReachedSignal is a signal/method for an AnimationTrack, not animations. You’ll probably have to load your animation and then play it manually. The code below should work for you. I also recommend using the DidLoop event for this if the animation is on a loop

local Animation;
Animation:GetMarkerReachedSignal("LeftFoot"):Connect(function()
 --Main code here
end)

i also tried this, but this is the walking animation for the character, so it didnt work.

Show me what you did in your new code

local Animation = script.Parent.Humanoid:LoadAnimation(script.Parent.Animate.walk.RunAnim)
Animation:GetMarkerReachedSignal("LeftFoot"):Connect(function()
	--Main code here
end)

Im pretty sure instead of the humanoid you have to refrence the animator inside of the humanoid.

well the walking animation isnt always playing in that, so how exactly would that work

I thought you were using your own walk animation with an animation event named “LeftFoot”. This will never work because well it doesn’t have that event. Try this:

local AnimationTrack;
Animation.DidLoop:Connect(function() 
		
end)

No. An animator is the instance that handles animations. Should be in every humanoid try using the method :LoadAnimation on it it never disappears and shouldnt be destroyed since that prevents any animation being loaded

I AM using my own walking animation where i added the animation events, and i put this is the npcs animate script under the walk property for the animation.

The thing is you have to play that animation by yourself. Roblox will internally play its own Animation Track and you will have your own when you load yours. These two are not the same so the animation events of roblox’s walk anim track wont fire to you

So your still saying it isnt possible?

local Animation = script.Parent.Humanoid.Animator:LoadAnimation(script.Parent.Animate.walk.RunAnim)
Animation:GetMarkerReachedSignal("LeftFoot"):Connect(function()
	print("WFf")
end)

Thats how it should be, what does it say now?

Yes, it isn’t impossible. Do these NPC’s use pathfinding or what do they do?

it does not print anything. no errors

they are moved to the player using :Move but it will change soon

Thats great, dont forget to play the animation firstly obviously. That event should be fired after the keyframe is reached.

Instead of using marker reached, use keyframe reached. Should work.

why and how would i just play the walking animation when it automatically plays when the npc is moving. Also i dont think it not printing is great