Keyframe event footsteps

How do i do this? What do i put into the Animate script to access the two keyframe events in my animation?

1 Like

https://developer.roblox.com/en-us/api-reference/event/AnimationTrack/KeyframeReached

animTrack.KeyframeReached:Connect(function(keyframeName)
	print("Keyframe reached:"..keyframeName)
end)

If you know the keyframe name then it should work.

If you don’t know how to rename keyframes (idk how to do it in the roblox animation editor):

How to

When exporting from moon animator for exame you get a folder with all the keyframes. You can rename them and those will be used for the keyframeName

Then just do

if keyframeName == "Step1" then Step1Sound:Play() end

Or randomize the step sounds instead of using one for each step for something more natural.

1 Like

How do i even get the right keyframename

i have no idea what the name of the walk anim variable is in the default roblox animation script

R15 and R6 have different Animate scripts… Can you tell me which one your using so I am able to help?

1 Like

it is r6. words are cool and such!!

Give me a moment to go into animate script and see where the walk animation is played

1 Like

If im correct the walk animation is played at LINE 326

I imported a small amount of code to make sure it checks if you reached a marker in the animation called Step

function onRunning(speed)
	if speed > 0.01 then
		playAnimation("walk", 1, Humanoid)
		
		currentAnimTrack:GetMarkerReachedSignal("Step"):Connect(function()
			print("Stepped")
		end)
		if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
			setAnimationSpeed(speed / 14.5)
		end
		pose = "Running"
	else
		if emoteNames[currentAnim] == nil then
			playAnimation("idle", 0.5, Humanoid)
			pose = "Standing"
		end
	end
end
3 Likes

@crolaa if you do not know how to make a animation marker click here: Using the Animation Editor (roblox.com)
follow the steps and you should be good.
Please reply if you have any more questions

1 Like

Thanks dude this works perfectly! I appreciate it.

1 Like

do not bump this post, what you said was random.