Hello I would like to have a way to run fake/test video ads to test my rewards to see if they work correctly.
My game where I’m adding this feature is available and has more than 2000 unique players per month but I can’t test my ad system I even tried to test in-game to see if I can watch an ad but it didn’t work. I think my code is good but there’s no ad available to watch because I ask to the server to look for an for the player before the player asks.
And it always fails to look for ads.
![]()
Please add this and it would be very helpful to get ready to support them correctly for the players because I don’t know yet if it would crash!
-- AD AVAILABILITY CHECK
local function checkAdAvailability(player)
-- Skip if player already has an ad available or global limit reached
if playersNeedingAds[player.UserId] == false then
return
end
-- Check global ad limit
if currentAdCount >= GLOBAL_AD_LIMIT then
-- Already have enough ads globally, skip this check
return
end
local success, canShow = pcall(function()
return AdService:CanShowRewardedVideoAdAsync(player)
end)
if success then
adAvailability[player.UserId] = canShow
print("Ad availability for", player.Name, "->", canShow, "| Global count:", currentAdCount)
-- Notify client of ad availability
local adAvailableRemote = ReplicatedStorage:FindFirstChild("AdAvailable")
if adAvailableRemote then
adAvailableRemote:FireClient(player, canShow)
end
-- Stop checking if ad found and increment global count
if canShow then
playersNeedingAds[player.UserId] = false
currentAdCount = currentAdCount + 1
print("Ad found! Global ad count now:", currentAdCount, "/", GLOBAL_AD_LIMIT)
end
else
adAvailability[player.UserId] = false
warn("Failed to check ad availability for", player.Name)
end
end