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 » Scripters
Home Search
 

Re: How do I make it so when a user buys a gamepass.. [CONT.]

Previous Thread :: Next Thread 
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 10:47 PM
[CONT.] they get the tool they requested INSTANTLY?

As in, when they buy it from my GUI I created, they do not have to rejoin to get the requested tool. Such thing can be found in Shake Shack when buying it from their SurfaceGUI shop, so I'm assuming it is possible.

Any help would be greatly appreciated, thanks.


Fendd || Graphic Designer || Current RAP:151,779
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 10:51 PM
I currently only have this is a seperate script.

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:wait()
if game:GetService("GamePassService"):PlayerHasPass(player, 544768303) then
game.Lighting:FindFirstChild("BloxyCola"):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild("BloxyCola"):Clone().Parent = player.StarterGear
end
end)


Fendd || Graphic Designer || Current RAP:151,779
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 10:52 PM
local productId = 548882115
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
script.Parent:FindFirstChild("SelectionPopSound"):Play()
game:GetService("MarketplaceService"):PromptPurchase(player, productId)
end)

and that to prompt the purchase.


Fendd || Graphic Designer || Current RAP:151,779
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 10:54 PM
[1]


Fendd || Graphic Designer || Current RAP:151,779
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 10:57 PM
[2]


Fendd || Graphic Designer || Current RAP:151,779
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 11:02 PM
[3]

I will pay if your solution works


Fendd || Graphic Designer || Current RAP:151,855
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 11:32 PM
[4]


Fendd || Graphic Designer || Current RAP:151,741
Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
08 Dec 2016 11:44 PM
local MarketplaceService = game:GetService("MarketplaceService")

gamepass = 123

MarketplaceService.ProcessReceipt = function(receiptInfo)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == gamepass then

end
end
end


return Enum.ProductPurchaseDecision.PurchaseGranted
end


Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
08 Dec 2016 11:45 PM
Forgot to mention I'm not sure if this works for gamepasses


Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 11:54 PM
Nah, doesn't seem to work.

Although I'm not sure if I'm isnerting it correctly.

Will paste script in after


Fendd || Graphic Designer || Current RAP:152,059
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
08 Dec 2016 11:59 PM
local MarketplaceService = game:GetService("MarketplaceService")

gamepass = 544768303

script.Parent.MouseButton1Click:connect(function()
script.Parent:FindFirstChild("SelectionPopSound"):Play()
game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, 544768303)
end)

MarketplaceService.ProcessReceipt = function(receiptInfo)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == gamepass then


game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:wait()
if game:GetService("GamePassService"):PlayerHasPass(player, 544768303) then
game.Lighting:FindFirstChild("BloxyCola"):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild("BloxyCola"):Clone().Parent = player.StarterGear
end
end)


end
end
end


return Enum.ProductPurchaseDecision.PurchaseGranted
end



Fendd || Graphic Designer || Current RAP:152,081
Report Abuse
Fendd is not online. Fendd
Joined: 24 Apr 2013
Total Posts: 10584
09 Dec 2016 12:00 AM
It gets to the purchase part, the transaction is completed but the BLoxyCola doesn't go into my inventory.

I'm sure I've done something stupid, can anybody help?


Fendd || Graphic Designer || Current RAP:152,081
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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