Hello, dear developers.
I’m currently struggling with an issue regarding the AdService:GetCampaignEligibilityAsync() function.
The function takes a campaignId: string. I copied the ID directly using the Copy ID button in Ads Manager, so I don’t think the ID itself should be the issue. Although, if possible, I’d appreciate it if someone could provide an example of a valid campaignId, since I’ve seen conflicting information about its format. Some people say it’s just a regular numeric ID, while others claim it’s a UUID.
Here’s a code snippet. The actual campaignId has been replaced since I’m unsure whether it’s safe to share publicly.
For context, :ExecutePolicy() is a function from a local module that’s used to show or hide ad campaign-related content depending on the result of :GetCampaignEligibilityAsync().
local success, response = pcall(function()
return AdService:GetCampaignEligibilityAsync("1231231231231231")
end)
if success and response.IsEligible then
_G.AllowUserAds = response.IsEligible
else
warn(response)
end
warn(`User is {response.IsEligible and "eligible" or "ineligible"} for ads`)
AdPolicyHandler:ExecutePolicy(workspace.Tycoons)
I believe the code itself is correct. There’s barely anything to mess up here, and it’s essentially identical to the example Roblox provided in their documentation.
I’ve also attempted to call the function on the client side, both while waiting for game:IsLoaded() and without waiting for it. I tried calling it from the server side as well. In that case, the function requires a second argument, which would be the player instance. On the client, it defaults to the local player, which is why the second argument isn’t required there.
None of these attempts produced any results.
At this point, I’ve tried so many potential fixes that listing all of them would honestly be pointless. I’m starting to believe this may simply be an issue on Roblox’s end, the fact that there’s not a single topic on this god forsaken forum discussing that single function doesn’t help either.