Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this developer product work?

Asked by 8 years ago

So im trying to make it show a gui when you buy it. but its not showing the gui. it prints but it doesnt show the gui

--Local script
workspace.RequestScreen.SurfaceGui:WaitForChild("Button").MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, 32468783)
end)

game:GetService("ServerStorage"):WaitForChild("Request").OnClientEvent:connect(function()
    local SongPicker = game.ReplicatedStorage.Requesting:Clone()
    SongPicker.Parent = game.Players.LocalPlayer.PlayerGui
    local CloneExploitChecker = Instance.new("StringValue", SongPicker)
    CloneExploitChecker.Name = ("Check"..game.Players.LocalPlayer.Name)
end)
--Regular Script
local MarketplaceService = game:GetService("MarketplaceService")

MarketplaceService.ProcessReceipt = function(receiptInfo) 
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            if receiptInfo.ProductId == 32468783 then
                print("works")
                game:GetService("ServerStorage"):WaitForChild("Request"):FireClient(player)
            end
        end
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

1 answer

Log in to vote
0
Answered by 8 years ago

You can only process receipts in a server script. However, the key is to take the player who bought your product and send it to a RemoteEvent when you have processed the payment, and handle that payment by making the script use the player instead of the LocalPlayer.

0
oops smh sorry i thought i deleted that part from the local script. but it is in a server script, so whats the problem? bubbaman73 143 — 8y
Ad

Answer this question