Buy function error guys need ur help

transact to FpsCrowdsale.buyTokens errored: VM error: revert.

The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
Debug the transaction to get more information.

:1234: Code to reproduce

    function buyTokens() public payable {
    require(publicBuyActivated == true);
    address payable transaction_sender = msg.sender;
    uint256 weiAmount = msg.value;
    _preValidatePurchase(transaction_sender, weiAmount);

    // calculate token amount to be created
    uint256 tokens = msg.value / _rate;

    _processPurchase(transaction_sender, tokens);
    emit TokensPurchased(transaction_sender, address(this), weiAmount, tokens);

    if (firstBuyTime[transaction_sender] == 0) {
        firstBuyTime[transaction_sender] = block.timestamp;

    //dai.transferFrom(msg.sender, __wallet, msg.value);


:computer: Environment


We need you to make a minimum level of effort when asking for help.

Give more context about what you're doing. Share what you tried and didn't work.

And avoid phrases like "need ur help". They will not get you any more answers, but the opposite.