How to fix: function returning false when looking through database

I have a function that looks for a given email and returns the userID if it finds one. But even if it finds your email it gives back false instead of the ID, I feel like I'm overlooking something, can someone help me out?

function checkWhetherEmailExists($email, $conn){
    $stmt = "SELECT UserID FROM users WHERE Email = ?";
    $stmt = $conn->prepare($stmt);
    $stmt->bind_param("s", $email);
    $stmt->execute();
    $result = $stmt->get_result();
    if($result->num_rows > 0){
        $row = $result->fetch_assoc();
        $userID = $row['UserID'];
        return $userID;
    }else{
        return false;
    }
}