Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to use the ShowAd() function?

So I was reading on the wiki, and I found the ShowAd() function. How would someone like me use this on a game I have?

Here the wiki post.

1 answer

✓ Accepted answer

When to show an ad

Round or level based games: Showing the ad automatically while players are waiting for the next round to load is a great way to not interrupt gameplay and provide a huge amount of ad impressions since every player will automatically see the ad each round.

Note: This only works in mobile as of now.

Note: You can only show 5 ads for each player every hour.

Code:

local adservice = game:GetService("AdService")  -- Define AdService
adservice:ShowVideoAd () -- Show Ad 

adservice .VideoAdClosed:connect(function(shown) -- Run when ad finishes where shown equals true or false depending if the ad showed or an error occurred
	if shown then -- If statement to check what happened
		print("Finished showing video ad.")	
	else
		print("The ad didn't get shown")
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.