Skip to content

Instantly share code, notes, and snippets.

@MafuSaku
Last active July 5, 2025 18:52
Show Gist options
  • Save MafuSaku/f4de470fd7a534e9477cc0898f96400b to your computer and use it in GitHub Desktop.
Save MafuSaku/f4de470fd7a534e9477cc0898f96400b to your computer and use it in GitHub Desktop.
Roblox Immersive Ads - GetPolicyInfo for AreAdsAllowed
local Players = game:GetService("Players")
local PolicyService = game:GetService("PolicyService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
-- Sample assumes a Main Portal Template and Image Ad Unit 1 model exists under Workspace
local mainPortal = Workspace:WaitForChild("Main Portal Template")
local mainImageAdUnit = Workspace:WaitForChild("Image Ad Unit 1")
-- Get the policy info for the user
local success, result = pcall(PolicyService.GetPolicyInfoForPlayerAsync, PolicyService, player)
if success and result then
if not result.AreAdsAllowed then
-- Destroy all Main Portal Template instances on the user's client if ads are not allowed
mainPortal:Destroy()
mainImageAdUnit:Destroy()
end
else
warn("Failed to get policy for player", player.Name, "Exception:", result)
end
@flamesongsngames
Copy link

Thank you

@ninjarayjeep
Copy link

you should change print("Failed to get policy for player", player.Name, "Exception:", result) to warn("Failed to get policy for player", player.Name, "Exception:", result)

@alimDamazanov
Copy link

@alimDamazanov
Copy link

jumpscare-golden-freddy
NOT WORKS

@alimDamazanov
Copy link

music-box.mp4

?

@alimDamazanov
Copy link

WHY NOT WORKS IN 2023

@JonathanP123yay
Copy link

I am going to try it!

@icrann
Copy link

icrann commented Sep 3, 2024

For anyone saying it doesn't work you must first meet the criteria in the Roblox Creator Hub, select the game you wish to place ads on, then under Monetisation go to Immerive Ads.

image

@xuxhex
Copy link

xuxhex commented Jul 5, 2025

whats the link for creater hub

@xuxhex
Copy link

xuxhex commented Jul 5, 2025

nevermind found it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment