Registering Reward Types

Learn how to define custom reward types for your game.

The GiftoinModule allows you to register custom reward types that fit your game's economy. Here's how to register a reward type(place it in a server-side script in ServerScriptService):


GiftoinModule.RegisterRewardType("Currency", function(player, amount)
    -- Add currency to player's account
    local leaderstats = player:FindFirstChild("leaderstats")
    if leaderstats then
        local currency = leaderstats:FindFirstChild("Currency")
        if currency then
            currency.Value = currency.Value + amount
        end
    end
end)

You can register multiple reward types:

GiftoinModule.RegisterRewardType("Item", function(player, itemId)
    -- Give item to player
    -- Your item granting logic here
end)

GiftoinModule.RegisterRewardType("Experience", function(player, expAmount)
    -- Add experience to player
    -- Your experience granting logic here
end)

Last updated