Animation events

I have been looking into Animation Events | Roblox Creator Documentation

I was wondering if it is possible to play separate events inside of an animation, without creating multiple other animations to play off of.

for example, if I wanted to open a gate halfway when a button is pressed, it would animate to open the gate halfway, then when it is pressed again it would open to the rest.

This isn’t what I’m trying to achieve I know there would be better ways to do that, but that is just an example.

You would use :AdjustSpeed() halfway through the animation to stop it before it’s finished, and continue it when you press the button again.

1 Like

Specifically, you would do Anim:AdjustSpeed(0), as this is the same thing as pausing it. It retains the position through the track, as opposed to Anim:Stop which fully stops it and resets the position, as well as cancelling the animation.

yes you can use animation events.
Its pretty easy to use.

Bind the animation event to the Humanoid.
Then use that event to open the gate or do whatever you want.

Example:

local Character = Player.Character
local Humanoid = Character.Humanoid

Humanoid.AnimationPlayed:Connect(function(Anim)
        if Anim.Name == "AnimName" then --The name of the animation
            --Code here
        end
end)