Function not working correctly!

@richard may i have some help? ive been struggling with this still for a few weeks