AdReward

Constructors

NameDescription
AdService:CreateAdRewardFromDevProductId(devProductId: number):AdRewardCreates an AdReward tied to the given developer product id. Called on the AdService, not on AdReward itself - AdReward has no direct new() constructor.

Code Snippet

local AdService = game:GetService("AdService")

local DEV_PRODUCT_ID = 0000000 -- replace with a real developer product id

local function showRewardedAd(player)
    local reward = AdService:CreateAdRewardFromDevProductId(DEV_PRODUCT_ID)
    local result = AdService:ShowRewardedVideoAdAsync(player, reward)

    if result == Enum.ShowAdResult.ShowCompleted then
        print(player.Name, "watched the ad - grant the reward")
    else
        warn(player.Name, "did not complete the ad:", result.Name)
    end
end