How to presale your tokens to automatically switch tokens

I want to presale my token, but I don’t know how when a buyer transfers BNB to my address my token will automatically pass on to the buyer a preset amount.
Help me