|
| 20 Aug 2015 11:11 AM |
so, I want to make the leaderstats increase the "Money" value 1000 when the game pass GUI is clicked, this is what I have so far: local button = script.Parent local marketplaceService = game:GetService("MarketplaceService") local player = game.Players.LocalPlayer local gamePassId = 284502010
script.Parent.MouseButton1Down:connect(function() marketplaceService:PromptPurchase(player, gamePassId) end)
local MarketplaceService = game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = 284502010
MarketplaceService.ProcessReceipt = function (receiptInfo)
for i,player in pairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.productId == productId then player.leaderstats.Money.Value = player.leaderstats.Money.Value +1000 end end end
local playProductKey = "player_"..receiptInfo.PlayerId.."_purchase_" .. receiptInfo.productId ds: incrementAsync(playProductKey)
return Enum.ProductPurchaseDecision.PurchaseGranted end |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 11:13 AM |
What exactly do you want? If you give someone a super long script and not know EXACTLY how you want help, you will never get an answer.
So far, I don't know what you are doing. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 11:18 AM |
so the leaderstats script is the following: print 'Hello world!' game.Players.PlayerAdded:connect(function(player) local leader, score = Instance.new('IntValue', player), Instance.new('IntValue') leader.Name = 'leaderstats' score.Name = 'Money' score.Parent = leader end) this makes the leaderstats name Money
so the button in the GUI is a Money increasment gamepass.the button is in the GUI like the following: game > starterGui > intro(Frame) > coins(the button) I want to increase the stats by 1000 when the gamepass is purchased. its letting me purchase it, but it wont increase my stats by 1000 |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 20 Aug 2015 11:20 AM |
| It has to be handled in a server script. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 11:20 AM |
"Scripters This is the place for discussion about scripting. Anything about scripting that is not a help request or topic belongs here."
Help requests don't belong here. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 11:21 AM |
the big script in is a local script. the leaderstats script is in a server script |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 11:24 AM |
| Make it a function then call out the function instead. Also is the leaderboard showing up for the value of money? |
|
|
| Report Abuse |
|
|
| |
|