What Happens If a Transaction Runs out of Gas?
If a transaction runs out of Gas (meaning the Gas Limit was set too low for the required computation), the transaction is immediately reverted. All state changes that occurred during the execution are undone, as if the transaction never happened.
Crucially, the user still pays the transaction fee for the Gas that was consumed up until the point of failure, as the network resources were still utilized.