I've been completely reworking the script for two days now, and I can't figure out why the "Rewarded Video Ads" feature isn't working. If you have any ideas, I'd appreciate your help. (I'm communicating with a translator, so I might be writing nonsense at times.)
local AdService = game:GetService("AdService")
local Players = game:GetService("Players")
local part = script.Parent
local ProximityPrompt = part:WaitForChild("ProximityPrompt")
local AdsID = 920480951670936
local devProductId = 3540972034
local function showAd(player)
local success, result = pcall(function()
local reward = AdService:CreateAdRewardFromDevProductId(devProductId)
return AdService:ShowRewardedVideoAdAsync(player, reward, AdsID)
end)
print("Ad success:", success)
print("Ad result:", result)
if success and result == Enum.ShowAdResult.ShowCompleted then
print(player.Name .. " finished watching the commercial")
else
print("Advertisement not completed or error")
end
end
ProximityPrompt.Triggered:Connect(function(player)
showAd(player)
end)