Can someone help me or make a tutorial on how to do this (gun mechanics)

Teach me how to do this, but for unreal please

Look up youtube tutorials, there is plenty of them…