Hi I’m currently trying to check when an animation has finished (or when an animation has reach a certain keyframe if I wanted the have the gun ammo reload at a certain point in time of the animation) and I’m currently looking at the documentation. AnimationTrack:GetMarkerReachedSignal() and AnimationTrack:Ended() are the two that have caught my eye. It’s just that I’m not sure how to use them for when specific animations play (for example when the reload animation plays). Can someone who understands explain them to me?
Could you be more specific?
Do you not know how to write the code or do you not understand when those events are called?
I understand how to write the code obviously as said in the documentation I’m just not sure what to do with them and how they work. Roblox’s explanation is hard to understand for me
Brief explaination:
-
AnimationTrack:Ended() is pretty straight foward: when the animation finishes or stops it is called
-
AnimationTrack:GetMarkerReachedSignal() is a bit more complicated:
I use Moon Animator for animations, so i don’t know how to do it on other animation plugins but there is an option to add KeyframeMarkers when making an animation.
You can assign names to these and AnimationTrack:GetMarkerReachedSignal() gets called when the animation reaches a keyframeMarker having the same name as argument 1 of said event.
I’ll send some examples if you still don’t understand. Don’t worry, it took me a while to understand
The two parts you described are a method and an event, and since they return a “RBXScriptSignal” you can do cool things with them like :Once(function() end)
, :Connect(function() end)
, and :Wait()
.
The exact things you’re looking for are AnimationTrack.Ended:Wait()
and AnimationTrack:GetMarkerReachedSignal("Blah"):Wait()
which yields the script until that method/event is fired. This is similar to just using task.wait(Number)
.
You can read up more about the various things to add at the end of “RBXScriptSignal” here: RBXScriptSignal | Documentation - Roblox Creator Hub
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.