Tripping the Rift: The Movie
(2000)

Chode and his crew go through several adventures, that all end poorly. All the while, Chode is being chased by a giant clown robot who is trying to assassinate him. He unknowingly thwarts the robot's plans to assassinate him several times.

After failing to retrieve a treasure from a planet, which actually ended up being a disguised slave trade, Chode really discovers what the clown is trying to assassinate him for. Chode had accidentally impregnated Bobo's daughter, and rather than aborting the child, he decided to simply kill Chode by sending the robot assassin back in time to kill Chode before he has sex with his daughter.

The Federation's captain's son travels back in time too, to warn Chode of what the assassin is doing. Chode agrees to not have sex with Bobo's daughter if he goes back into the future and tells Bobo to call off the attack.

In the future, the captain's son is revealed to really be the person who impregnated Bobo's daughter, and simply used Chode as a scapegoat. Bobo decides to kill Chode anyway.

After some discussion, Bobo agrees to call off the assassination as long as the captain's son does not have sex with his daughter in the past. They agree (though their fingers are crossed behind their backs, implying they have sex anyway), and Chode lives, only to steal the robot assassin once it is deactivated.

Gus reprograms the robot to dance on command, and the movie ends with all of Chode's crew having a disco ball aboard the ship as it flies off.

Thanks Salvatore!