No. There is no legitimate way to generate free hats in Roblox, and the sites claiming otherwise are after your password.
What does work: the Avatar Shop frequently has inexpensive accessories, developers give away free items in their games, and Roblox hands out promotional hats during official events. Those are the only routes to a hat that will not cost you your account.