Everything is possible! Multiple ways to do what you want, easy way is prob :
You could just have a "chance" to lockpick the lock, on fail set animation to fail animation.
So in a variable of 100
the user chance to lockpick is 20
then on start of lockpick, roll the dice by setting the lockpick rate variable to "random (1,100)
If lockpick variable = or less than 20 , lockpick, if more than 20 fail the lockpick.
Not sure how to put it out haha, add me on discord and i will help you after work.
Skyrim has a "dice" that rolls aswell, and you can level up lockpicking skill.