Last active
July 5, 2025 18:52
-
-
Save MafuSaku/f4de470fd7a534e9477cc0898f96400b to your computer and use it in GitHub Desktop.
Roblox Immersive Ads - GetPolicyInfo for AreAdsAllowed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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)
music-box.mp4
?
WHY NOT WORKS IN 2023
I am going to try it!
whats the link for creater hub
nevermind found it
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you