What is Adservice?

I was going through some code (again) and found this:

game:GetService("AdService"):ShowVideoAd()
 
game:GetService("AdService").VideoAdClosed:connect(function()
	print("Finished showing video ad.")	
end)

-- Script
 
-- Create RemoteEvent to handle turning on ForceField and put it
-- in ReplicatedStorage so both Server and Client can see it
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = "ForceFieldEvent"
remoteEvent.Parent = game.ReplicatedStorage
 
-- Define function to call when the RemoteEvent is fired
remoteEvent.OnServerEvent:connect(function(player, turnOnForceField)
	-- Check to make sure the player has a character model (if 
	-- not then no need to ForceField)	
	local character = player.Character
	if character then
		if turnOnForceField then
			-- If turnOnForceField then make a new ForceField and give
			-- it to the character
			local forceField = Instance.new("ForceField")
			forceField.Name = "AdForceField"
			forceField.Parent = character
		else
			-- If not turnOnForceField then remove the ForceField
			-- from the character
			local forceField = character:FindFirstChild("AdForceField")
			if forceField then
				forceField:Destroy()
			end
		end
	end
end)

-- LocalScript
 
-- Bind function to when video ad finishes. Call RemoteEvent to
-- remove the player's ForceField
game:GetService("AdService").VideoAdClosed:connect(function()
	game.ReplicatedStorage.ForceFieldEvent:FireServer(false)
end)
 
-- Define function that will play ad and call RemoteEvent to give
-- player a ForceField
local function playAd()
	game:GetService("AdService"):ShowVideoAd()
	game.ReplicatedStorage.ForceFieldEvent:FireServer(true)
end
 
-- Binding playAd to the mouse click of a text button. Does not have
-- to be like this in your game, simply call playAd when you want
-- an ad to be played
script.Parent.MouseButton1Click:connect(playAd)

What is Adservice because if i go to the Roblox wiki and click it it brings up a blank webpage:

1 Like

AdService was a service used for showing ads within the Roblox client. It was later removed.

5 Likes

The wiki page works fine for me and has all the information you need and might want.

1 Like

Even though it has been removed it should at least have a webpage that says it has been removed or just have no webpage at all.

1 Like

1 Like

That’s strange, for some reason i cant view the webpage:

1 Like