Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't this Dev Product script award Money in game?

So, I have a script that checks the value of a NumValue which increases by different amounts (increasing by whatever upgrade the player is on) and when you purchase this DevProduct it's supposed to access the NumValue (named Dolla), add 100 to the value, and then change the text that displays how much money you have to the new value of the NumValue (Dolla)

EDIT: I think it might have something to do with the fact that when I defined "money", I did game.Players.Player, so it will try to award the player "Player" with the 100 cash. I'm gonna try to fix it with this.

Script in Workspace:

local developerProduct = 23235607 

local increaseMoney = 100

 local money = game.Players.Player.PlayerGui.MoneyAppearenceGUI.moneyOwned
local dolla = game.Players.Player.PlayerGui.MoneyAppearenceGUI.moneyOwned.Dolla

Game:GetService("MarketplaceService").ProcessReceipt = function(receipt)

    if receipt.ProductId == developerProduct then 

        for i,v in pairs(game.Players:GetPlayers()) do 

            if v.userId == receipt.PlayerId then 

                if v.Character and v.Character:FindFirstChild("Humanoid") then

                money.Text = dolla.Value + 100 
				wait(0.1)				
				money.Text = dolla.Value
                end

            end

        end

    end

end

LocalScript in the TextButton you purchase it through:

local marketplace = Game:GetService("MarketplaceService")

local developerProduct = 23235607 

local player = game.Players.LocalPlayer

 

script.Parent.MouseButton1Down:connect(function()

    marketplace:PromptProductPurchase(player, developerProduct)


end)

1 answer

At the end on line 28 (Script 1) you must put this code to tell roblox you processed the purchase, otherwise it will not work!

return Enum.ProductPurchaseDecision.PurchaseGranted
  • I hope this helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.