Everything makes sense in my head. I don't understand why when I click on the button it does not work. I believe the problem is in these text lines
        mouse = pygame.mouse.get_pos()
        if mouse[0] >= rand_x <= player_size and mouse[1] >= rand_y <= player_size:
            sys.exit()"""
 
     
    