Alright so I have a blacksmith who has an animation that loops while he hits the anvil with his hammer. I want a small sound effect to play when the animation loops. I would want more specifically for the sound to play at the end of the animation since thats when his hammer actually makes contact with the anvil, but either way is fine. Here’s the code that I have. It’s a script inside of my blacksmith. I’m also not getting any errors in my output.
local Sound = script.Parent.Sound --sound path
local Animation = script.Parent.Anim --animation path
local Humanoid = script.Parent.Humanoid --humanoid path
local AnimationTrack = Humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
Sound:Play()
AnimationTrack.DidLoop:Wait()
Sound:Stop()