Pythoz
|
  |
| Joined: 08 Jan 2012 |
| Total Posts: 18 |
|
|
| 09 Mar 2014 07:45 AM |
I've been trying to make a shop gui that brings up the prompt purchase thing. Can someone explain to me in full detail why the following script doesn't work. Please just don't refer me to the wiki, I'd like an explanation on what to improve and why it doesn't work. By the way I'm not asking you to write code for me I just need to know what I'm doing wrong
Script: local MarketplaceService = game:GetService("MarketplaceService") local buyButton = script.Parent local productId = 148898084 buyButton.MouseButton1Down:connect(function() MarketplaceService:PromptProductPurchase(player, productId) end)
When I write this there is an error about the player but when I define the player for example as "game.Players.Pythoz", There is no error but it does not work. |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 09 Mar 2014 07:47 AM |
A. use a LocalScript
B. define player
C. Yield until player
(Ex of this: repeat wait() until game.Players.LocalPlayer player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
Aphyllous
|
  |
| Joined: 18 Sep 2013 |
| Total Posts: 300 |
|
|
| 09 Mar 2014 07:48 AM |
put this in a localscript
local player = game.Players.LocalPlayer local MarketplaceService = game:GetService("MarketplaceService") local buyButton = script.Parent local productId = 148898084
buyButton.MouseButton1Down:connect(function() MarketplaceService:PromptProductPurchase(player, productId) end) |
|
|
| Report Abuse |
|
|
Pythoz
|
  |
| Joined: 08 Jan 2012 |
| Total Posts: 18 |
|
|
| 09 Mar 2014 07:55 AM |
| @Aphyllous I put that in a localscript, nothing happens no error no nothing. |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 09 Mar 2014 07:56 AM |
He didn't yield before defining player.
Happens a lot in LocalScripts... |
|
|
| Report Abuse |
|
|
Pythoz
|
  |
| Joined: 08 Jan 2012 |
| Total Posts: 18 |
|
|
| 09 Mar 2014 08:00 AM |
@Bebee2, No luck.
repeat wait() until game.Players.LocalPlayer local player = game.Players.LocalPlayer local MarketplaceService = game:GetService("MarketplaceService") local buyButton = script.Parent local productId = 148898084
buyButton.MouseButton1Down:connect(function() MarketplaceService:PromptProductPurchase(player, productId) end) |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 09 Mar 2014 08:06 AM |
| Are you testing the game in studio or actually playing it? |
|
|
| Report Abuse |
|
|
Pythoz
|
  |
| Joined: 08 Jan 2012 |
| Total Posts: 18 |
|
| |
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 09 Mar 2014 08:08 AM |
| Is this a Developers Product or an actual item? |
|
|
| Report Abuse |
|
|
Pythoz
|
  |
| Joined: 08 Jan 2012 |
| Total Posts: 18 |
|
|
| 09 Mar 2014 08:14 AM |
| Ohh I just realized, I was trying to use a game pass. Ok, I've now got the developer product working but how would I use this with game passes? |
|
|
| Report Abuse |
|
|
Pythoz
|
  |
| Joined: 08 Jan 2012 |
| Total Posts: 18 |
|
|
| 09 Mar 2014 08:17 AM |
| Never mind I just figured it out, Thanks for your assistance :) |
|
|
| Report Abuse |
|
|