Exports

Server exports to add or remove coins and to count battle pass challenge progress from your own scripts.

All exports are server-side. Call them from your own server scripts after gg_coinshop has started. Never pass an amount that comes from the client: decide the amount in your server code.

AddCoins

Adds coins to an online player's balance.

Lua
local success, balance = exports.gg_coinshop:AddCoins(playerId, 100)

RemoveCoins

Removes coins from an online player's balance. It fails if the player does not have enough coins.

Lua
local success, balance = exports.gg_coinshop:RemoveCoins(playerId, 25)

Parameters and returns

NameTypeDescription
playerIdnumberThe online player's server ID
amountnumberA whole number from 1 to 2147483647
successbooleantrue when the balance changed, false otherwise
balancenumberThe new balance, only when success is true

Both exports use the same coin balance as the store, and the open store updates straight away. They do not create a Tebex transaction.

false means the amount is invalid, the player is not online, the player has too few coins (RemoveCoins) or the balance would pass 2147483647 (AddCoins).

Lua
-- Example: pay 50 coins when a player finishes your event
local ok, balance = exports.gg_coinshop:AddCoins(source, 50)
if ok then
    print(("Player %s now has %d coins"):format(source, balance))
end

challenge

Counts progress on a battle pass daily challenge. Use it to make your own scripts give battle pass XP.

Lua
exports.gg_coinshop:challenge({
    source = source,
    challenge_id = "my_challenge_key",
    count = 1,
})
FieldTypeDescription
sourcenumberThe player's server ID
challenge_idstringThe challenge key you set in the Admin Panel
countnumberProgress to add. Defaults to 1.

To set it up:

  1. Open Admin Panel > Battle Pass > Challenges and create a challenge with a key, the required count and the XP it gives.
  2. Click Copy export string on the challenge. It copies the call above with your key filled in.
  3. Paste it into your server script where the action happens.

Several challenges can share one key, for example "Finish 5 routes" and "Finish 20 routes". One call counts towards each of them the player has that day. The call does nothing when daily challenges are turned off in Settings > Battle Pass.

Support

Questions before you buy?

Ask the team in our Discord before you pay a thing. Setup help, update notes, giveaways and discount codes, all in one place.

831 online now2,241 members