How do I play a sound when I reach a keyframe in an animation?

Hello,
I want to play the sound according to the reload animation of the gun. But there’s a problem.
How do I play a sound when I reach a keyframe in an animation?
I already tried to use KeyframeReached and Marker.
And I don’t know how to use them and they don’t work well.
Thanks for reading!

2 Likes

Hello! Could you send the script you are currently using right now?

1 Like

You can rename the keyframe to tell when to play the sound. For example,

animTrack.KeyframeReached:Connect(function(keyframeName)
	if keyframeName == "Test" then
		-- play audio
	end
end)

If you name the keyframe “Test” it will run the code.

1 Like

In the animation editor make sure to add an animation event.

I have dozens of weapons. Is there a way to get an event when you go after one keyframe in the animation with out setting event?