I have some code that loops that I found but I don't know how to call it and if it works. This the the
I have added that is called from a button when pressed. The contractfunction safeMint(address to, uint256 _mintAmount) public payable {
require(totalSupply() < MAX_SUPPLY, "Cannot Mint more");
require(msg.value >= mintRate, "Not enough Ether sent.");
require(_mintAmount <= maxMintAmount, "Max Minted");
require(msg.value >= mintRate * _mintAmount);
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
for(uint i = 0; i < _mintAmount; i++){
uint supply = totalSupply();
safeMint( msg.sender, supply);
}
}
is the code that is the safeMint function how do I call this with my curent code. note** Before I added the loop to make multiple mint at a time the function was working fine it doesnt work now because I dont know how to call it.