Is it possible to set the value of contstructor like modifier to set the value?

Link of the contract:https://github.com/laronlineworld/autoswap/blob/main/autoswap.sol

pragma solidity ^0.5.0;

// SPDX-License-Identifier: MIT


contract BIMPCrowdsale is Crowdsale , CappedCrowdsale{
    
address public owner;
    
uint256 public investorHardCap =250000000000000000;
        
mapping(address => uint256) private _contributions;
    
constructor (uint256 rate,uint256 cap, address payable wallet, IERC20 token)
        public
       
        Crowdsale(rate, wallet, token)
        CappedCrowdsale(cap)
        
    {
      owner = msg.sender;
        // solhint-disable-previous-line no-empty-blocks
    }
    
    modifier onlyOwner() {
       if (owner == msg.sender) _;
    }
    
    function _preValidatePurchase(
        address beneficiary,
        uint256 weiAmount
    )
    internal view
    {
        super._preValidatePurchase(beneficiary, weiAmount);
    
        require( _contributions[beneficiary].add(weiAmount) <= investorHardCap, "Beneficiary's cap exceeded");
    
    
    }
    
    
    function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
        super._updatePurchasingState(beneficiary, weiAmount);
        _contributions[beneficiary] = _contributions[beneficiary].add(weiAmount);
    }
    
    using SafeERC20 for IERC20;
    function transferToken(IERC20 token, address to, uint256 amount)  public onlyOwner  {
        token.safeTransfer(to, amount);
    }
    
    //new function
    
    function setInvestorHardCap (uint256 newInvestorHardCap) public onlyOwner() {
        investorHardCap = newInvestorHardCap;
    }

//   function InvestorHardCap() public view returns (uint256) {
//     return investorHardCap;
// }

  function setRate(uint256 newRate) public onlyOwner() {
        rate = newRate;
    }
    
     function setCap(uint256 newCap) public onlyOwner() {
        cap = newCap;
    }
    
     function setWallet(uint256 newWallet) public onlyOwner() {
        wallet = newWallet;
    }
    
     function setTokenAddress(uint256 newTokenAddress) public onlyOwner() {
        token = newTokenAddress;
    }

    
}

This modifier should not be done that way.

It should be

modifier onlyOwner() {
    require(_owner == _msgSender(), "Ownable: caller is not the owner");
    _;
}

That way no one wastes the gas when trying to call a function they literally cannot use. Otherwise people could call a function, waste gas, and nothing happens. Require stops this.

A modifier does not set the value unless you want it to.

By setting the value of a constructor? What do you mean by this? Do you want it to have different values within it?

@Lloyd_Ramos What are you asking about here? The question is not at all clear. Please try to explain yourself better.

upon deploying the contract, you need to set the value of the rate,cap,wallet and token address, that variables are from the constructor, I’m figuring out how to modify or set the value of the variable declare on the construtor, like setting up a new value of or changing ownership function.

Just want to set the value in the constructor like a value declare.
ex.
uint256 public investorHardCap =250000000000000000;

function setInvestorHardCap (uint256 newInvestorHardCap) public onlyOwner() {
    investorHardCap = newInvestorHardCap;
}

how about the:

constructor (uint256 rate,uint256 cap, address payable wallet, IERC20 token)
public

    Crowdsale(rate, wallet, token)
    CappedCrowdsale(cap)

function setRate(uint256 newRate) public onlyOwner() {
rate = newRate;
}

 function setCap(uint256 newCap) public onlyOwner() {
    cap = newCap;
}

 function setWallet(uint256 newWallet) public onlyOwner() {
    wallet = newWallet;
}

 function setTokenAddress(uint256 newTokenAddress) public onlyOwner() {
    token = newTokenAddress;
}