can’t get hard

my boyfriend gets hard fine when we’re grinding and stuff but the second we try to have sex it goes soft. it has happened multiple times and we don’t know why. anyone know?