|
| 07 Aug 2015 06:54 PM |
So I am working on a tycoon and have inserted mobile ad revenue. I am just asking how to a script a button I have created so that it shows a player an ad and gives them a certain value of cash (I guess 5000) when clicked I looked on YouTube and couldn't find any with the same problem, but the roblox wiki states that this is possible, but doesn't show how. I hope you have time to respond |
|
|
| Report Abuse |
|
|
LegitFake
|
  |
| Joined: 03 Mar 2014 |
| Total Posts: 81 |
|
|
| 07 Aug 2015 07:17 PM |
| need more detail to help you out |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 07:57 PM |
Basically you insert this script in the starter gui or starter pack and it makes an ad play when a player joins the game (only for roblox mobile) game:GetService("AdService"):ShowVideoAd() game:GetService("AdService").VideoAdClosed:connect(function() print("Finished showing video ad.") end) I am trying to make a button that gives 5000 cash (cash is my games currency) when it is pushed, but the ad has to be played. More info on this can be found at http://wiki.roblox.com/?title=Mobile_Video_Ads I really tried but I always fail so I came to the forum for help. |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 08:00 PM |
| I don't know Roblox syntax, but you probably need to have it be that if the ad doesn't load it closes immediately, and if the ad screen is open for more than 10 seconds, then the ad had to have loaded by then. It's not perfect, but that's my thoughts. |
|
|
| Report Abuse |
|
|
Blues714
|
  |
| Joined: 23 Dec 2008 |
| Total Posts: 6507 |
|
|
| 07 Aug 2015 08:03 PM |
Never worked with this AdService but I'll see what I can do.
debounce = false script.Parent.BUTTONNAME.MouseButton1Down:connect(function() if debounce == false then debounce = true game:GetService("AdService").VideoAdClosed:connect(function() -- script here end) end)
--
Create an algorithm that gives the player cash, in place of the "script here" |
|
|
| Report Abuse |
|
|
Blues714
|
  |
| Joined: 23 Dec 2008 |
| Total Posts: 6507 |
|
|
| 07 Aug 2015 08:04 PM |
Oops! I forgot to set debounce to false!!
debounce = false script.Parent.BUTTONNAME.MouseButton1Down:connect(function() if debounce == false then debounce = true game:GetService("AdService").VideoAdClosed:connect(function() -- script here end) end) debounce = false |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 08:09 PM |
| Not at home right now, but I will make sure to try it when I get back and thanks for your help lol |
|
|
| Report Abuse |
|
|