I’m trying to understand how to work with Roblox Immersive Ads based on the official documentation: Immersive ads | Documentation - Roblox Creator Hub.
According to the example code provided:
local function grantReward(PlayerId)
-- grant an in-game reward
end
local function showRewardPrompt(PlayerId)
-- show Prompt
end
local function hideRewardPrompt(PlayerId)
-- hide Prompt
end
local AdGui = script.Parent
AdGui.OnAdEvent = function(eventData)
local AdEventType = eventData.AdEventType
local PlayerId = eventData.PlayerId
if AdEventType == Enum.AdEventType.RewardedAdLoaded then
showRewardPrompt(PlayerId)
return true
elseif AdEventType == Enum.AdEventType.RewardedAdGrant then
grantReward(PlayerId)
hideRewardPrompt(PlayerId)
return true
elseif AdEventType == Enum.AdEventType.RewardedAdUnloaded then
hideRewardPrompt(PlayerId)
return true
end
return false
end
It seems like the code listens for event to determine if ad is loaded, watched or unloaded(didn’t load), but doesn’t show any explicitly query for Reward Ad, I don’t understand how the Rewarded Ad is actually requested.
Looking for possible answers to the following questions:
- How do I work with
RewardedAd
, including querying Roblox to load a rewarded ad? - Can AdGui work as a 2D GUI (like ScreenGui), or does it only work with 3D parts? If it can, how?
Also, I have inserted an ad here: https://www.roblox.com/games/11188299153
However, the ad doesn’t seem to be loading or being shown to players.