I remember randomly seeing this movie on TV when I was a kid in the mid-late 90s. The title was something like “Captain ____ and the Adventures of _____”. Totally a B movie, possibly not an American movie but in English. It was a comedy film set in space, there’s a guy who wears a cowboy hat (the leader??) and one scene I remember a lot is where they go to this alien bar and when the cowboy guy walks in everyone looks at him because he’s like the hero of the film but no one really likes him. It’s not any of the Star Wars films and it’s not Spaceballs.