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: How to make promptpurchase work with surface guis?

Previous Thread :: Next Thread 
epicpatrick123 is not online. epicpatrick123
Joined: 08 Sep 2010
Total Posts: 15039
19 Dec 2013 07:14 PM
script.Parent.Text = "SALES: "..(Game:GetService('MarketplaceService'):GetProductInfo(34762561).Sales)
function onclick()
local player = script.Parent.Parent.Parent.Parent.Parent.userId
Game:GetService("MarketplaceService"):PromptPurchase(player, 34762561, IsPurchased)
if isPurchased == true then script.Parent.Text = "SALES: "..(Game:GetService('MarketplaceService'):GetProductInfo(34762561).Sales) else script.Parent.Text = "SALES: "..(Game:GetService('MarketplaceService'):GetProductInfo(93125465).Sales)
end
end
script.Parent.MouseButton1Click:connect(onclick)
Report Abuse
epicpatrick123 is not online. epicpatrick123
Joined: 08 Sep 2010
Total Posts: 15039
19 Dec 2013 07:16 PM
btw the script is in a button inside a surface gui inside a brick inside workspace
Report Abuse
Quorum is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
19 Dec 2013 07:31 PM
As I said on your other thread, you cannot get the player who used any aspect of the SurfaceGui, unless it's in their PlayerGui, in which case you can just parent up to their player, or if you're using a 'LocalScript' you can simply do 'game.Players.LocalPlayer'.
Report Abuse
epicpatrick123 is not online. epicpatrick123
Joined: 08 Sep 2010
Total Posts: 15039
19 Dec 2013 07:48 PM
i have no idea about how to do that lol, i've dealt with adornees before but idk how to now
Report Abuse
Quorum is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
19 Dec 2013 08:08 PM
Put the SurfaceGui into 'StarterGui'. You'll need to rework some of the parenting, etc.

local MarketPlace = game:GetService("MarketplaceService")
local ID = 34762561
local Player = game.Players.LocalPlayer

script.Parent.Parent.Adornee = Workspace.Whatever.Whatever
script.Parent.Text = "Sales: "..MarketPlace:GetProductInfo(ID).Sales

script.Parent.MouseButton1Down:connect(function()
MarketPlace:PromptPurchase(Player, ID) --// The third argument is used for gears.
script.Parent.Text = "Sales: "..MarketPlace:GetProductInfo(ID).Sales --// Might aswell just update it each time.
end)
Report Abuse
epicpatrick123 is not online. epicpatrick123
Joined: 08 Sep 2010
Total Posts: 15039
19 Dec 2013 08:23 PM
Thanks, I fixed the parents and it worked :)
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