To be honest, I also have no idea for that, at first, I thought of adding an additional collision at the end of the moving door to check whether it collides with the player or not, but I think that's a bad idea.