Get animation event from default animation not working

I managed to get the default run animation, and added an event to it called ‘Step’

I then upload, export as model, and apply to the character when they load. However, the Step event never gets fired


image

local function AnimationPlayed(animationTrack)
	if animationTrack.Name ~= "RunAnim" then return end
	print(animationTrack) -- prints RunAnim
	animationTrack:GetMarkerReachedSignal("Step"):Connect(function()
		print("STEP")
	end)
end

from what ive seen in the doc you need to load the track to the humanoid then you can do GetMarkerReachedSignal

like this:

local function AnimationPlayed(animationTrack)
	if animationTrack.Name ~= "RunAnim" then return end
	local animTrack = humanoid:FindFirstChildOfClass("Animator"):LoadAnimation(animationTrack)
	animTrack:GetMarkerReachedSignal("Step"):Connect(function()
		print("STEP")
	end)
end

You need a valid AnimationTrack instance to be able to listen for marker reached signals. To do this you need to load the Animation instance first through a call to the “:LoadAnimation()” method, this returns an AnimationTrack instance.

cc @Forummer

You’s obviously don’t know what AnimationPlayed is and how it works. It returns an AnimationTrack, that’s been played.

I’ve used this same method before, on custom animations I’ve done, and never needed to load the animation from the AnimationPlayed event, as it already returns a loaded animation

1 Like

You need to load an animation before playing it.

That’s not what my question is asking… default roblox animations load automatically… the event if fired when the animation has played… ergo the animation has already loaded, as it just played…

Please read the documentation

1 Like