This guide shows how to set up and track coin payouts so that in case a payout fails, no ingame currency is deducted from the player. Not using these triggers will result in players spending their resource without receiving any Modd Coins every time a payout fails.
Most important rule for script payouts: Never deduct the ingame currency before the payout was confirmed as successful!
Game
Sandbox for copying scripts
This demo is set up so you can transfer the scripts to your game. Simply create a player variable named CoinPayoutAmount
, then copy the coin
folder from World Scripts.
Setup Instructions
-
create a variable for
Player
namedCoinPayoutAmount
(number), copy thecoin
folder from this game to your game (found in World Scripts).
-
set up your
Daily coin transfer limit
in theMonetization
tab (can only be done from ingame editor).
-
create a currency that can be converted to modd coins. In this example, I am using a unit attribute Blob Coins which can be obtained by simply pressing Space.
-
before running the
transaction attempt
script, you need to set the value of the player variableCoinPayoutAmount
to the amount of coins you want to pay out. In our example, this is done in the Homie scriptpay out Blobs as Modd Coin
. You can have different scripts that set different payout amounts.
-
A successful payout triggers the World Script
transaction confirmed
. In this script, deduct the ingame currency from the player. The demo uses blob coin, but you can set up if conditionals to check for payout types that deduct different resources as well.