Entity:ResetSequence
Description
Plays an animation on the entity. This may not always work on engine entities.
This will not reset the animation on viewmodels, use Entity:SendViewModelMatchingSequence instead.
This will not work properly if called directly after calling Entity:SetModel. Consider waiting until the next Tick.
Will not work on players due to the animations being reset every frame by the base gamemode animation system. See GM:CalcMainActivity.
For custom scripted entities you will want to apply example from ENTITY:Think to make animations work.
Arguments
1 number or string sequence
The sequence to play. Also accepts strings.
If set to a string, the function will automatically call Entity:LookupSequence to retrieve the sequence ID as a number.
Example
Minimal code needed to make sequences work as expected on custom "anim" type entities.
In this example, when the player uses the crate, it will open, and when they use it again, it will close.