It’s in the title, how would I execute my code at certain points of an animation track, say in the middle of an animation or at the end. Is there an event or function that I can use other than using boring wait()s.
You can configure your animation via the animation editor to have keyframes at certain points of the animation with a name that isn’t “Keyframe” and use the KeyframeReached
event to decent when that keyframe has been reached
Do you know whether it’s possible to do this in moon animator? I don’t see the option anywhere.
That I’m unsure of as I never really used moon animator before, are you able to configure a moon animation using the built-in animation editor?
Yes, but do I simply rename the keyframe or add an animation event?
First make an animation, then in the animation make an event on the keyframe… and add a name
then use this,
AnimationTrack:GetMarkerReachedSignal("Your_Animation_Name"):Connect(function(paramString)
print(paramString)
end)
Attention: In the “Your_Animation_Name”, just paste the name of your animation event.And the name should be a string.!
For more Information, Take a look here:AnimationTrack | Roblox Creator Documentation
Oh right, I forgot GetMarkerReachedSignal
existed haha, You can try either what I said or what @ReaPercLawssYt mentioned
What do I put in paramstring? The article didn’t really touch on it.
paramString
is just the name of the parameter of the thing taht that event gives, you can name it anything. GetMarkerReachedSignal
returns the Name of the Marker that the event is being created for
Ah thank you, have a solution, At least you cleared it up.
Anytime! If you have anymore questions don’t be afraid to ask! And if you have anymore issues don’t be afraid to make another post!
Hey when I go to name my animationevent, there’s an empty parameter bar there. What is it commonly used for?
Could you send me an image of that since I haven’t touched the Animation Editor in a long while
Edit: I think @sudachipapa may be correct about that, do simple test and see what it prints for the parameter of GetMarkerReachedSignal if it prints either the name of the marker or the thing in that parameter
Maybe that is what gets passed as the paramstring? So it could be anything you like.
Okay I checked out the Roblox Dev Wiki, and yes the thing you give it in Parameter
will be returned to paramString
in this case, so if you write yes
, if you print paramString
, it will print yes
for that Event only. Keep in mind that the parameter will always be a string, so you have to convert it if needed
I understand that, but what do people usually use the strings for? As reference? To check if the event is present?
It’s typically used to pass in a certain thing to do something. Like for example, passing in the name of an object to clone when that marker is reached
I tried printing it. it prints the parameter’s name as a string…
Output: