I am trying to use the KeyFrameReached() function in an animation to do something when an animation gets to a certain point, but I am stuck on how to do that this is the wiki page
This is the example:
local anim = Instance.new("Animation") local keyframesReached = 0 anim.AnimationId = "http://www.roblox.com/Asset?ID=27789359" local animTrack = game.Workspace.Player1.Humanoid:LoadAnimation(anim) animTrack.KeyframeReached:connect(function(keyframeName) keyframesReached = keyframesReached + 1 print("Keyframe #"..keyframesReached..": "..keyframeName) end) animTrack:Play() wait(15) animTrack:Stop()
How would I be able to stop and animation at say the 10th frame and then wait(5) and then continue? Would I do:
if keyframesReached == 10 then animTrack:Stop() wait(5) animTrack:Play() -- Would this play from the beginning or from the 10th/11th frame? end