generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Developer Problem Help[REQUESTING GOOD EXPLANATION]

Previous Thread :: Next Thread 
Pythoz is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Pythoz
Joined: 08 Jan 2012
Total Posts: 18
09 Mar 2014 08:07 AM
I'm actually playing it
Report Abuse
Bebee2 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image