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

Prompt Purchase isn't working?

Asked by 4 years ago

both in studio and in game it says the same thing "This item is currently not for sale" i'm trying to sell clothing assets in game.

-- Local Script in StarterPlayerScripts
rs = game:GetService("ReplicatedStorage")
player = game:GetService("Players").LocalPlayer
mouse = player:GetMouse()
remotes = rs.Remotes
pp = remotes:WaitForChild("Prompt_Purchase")
mouse.Button1Up:connect(function()
    if mouse.Target.Name == "Purchase_Button" then
        local property = mouse.Target.Parent.Parent.Figure:FindFirstChild(mouse.Target:FindFirstChildOfClass("StringValue").Name)[mouse.Target:FindFirstChildOfClass("StringValue").Name.."Template"]
        local str = tostring(property)
        local num = tonumber(str:match("%d+"))
        pp:FireServer(num)
    end
end)

-- Server Script in ServerScriptService
rs = game:GetService("ReplicatedStorage")
remotes = rs.Remotes
pp = remotes:WaitForChild("Prompt_Purchase")
pp.OnServerEvent:connect(function(player, id)
    print(player.Name..", "..id)
    game:GetService("MarketplaceService"):PromptPurchase(player, id)
end)
0
I Have the same problem CrownedFigure 45 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

The reason is roblox changed

PromptPurchase

to this

PromptGamePassPurchase

so try this:

-- Local Script in StarterPlayerScripts
rs = game:GetService("ReplicatedStorage")
player = game:GetService("Players").LocalPlayer
mouse = player:GetMouse()
remotes = rs.Remotes
pp = remotes:WaitForChild("Prompt_Purchase")
mouse.Button1Up:connect(function()
    if mouse.Target.Name == "Purchase_Button" then
        local property = mouse.Target.Parent.Parent.Figure:FindFirstChild(mouse.Target:FindFirstChildOfClass("StringValue").Name)[mouse.Target:FindFirstChildOfClass("StringValue").Name.."Template"]
        local str = tostring(property)
        local num = tonumber(str:match("%d+"))
        pp:FireServer(num)
    end
end)

-- Server Script in ServerScriptService
rs = game:GetService("ReplicatedStorage")
remotes = rs.Remotes
pp = remotes:WaitForChild("Prompt_Purchase")
pp.OnServerEvent:connect(function(player, id)
    print(player.Name..", "..id)
    game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id)
end)
0
i tried that and then a ton of errors pop up and one is CorePackages.Packages._Index.roblox_rodux.rodux.NoYield:26: CorePackages.Packages._Index.roblox_purchase-prompt.purchase-prompt.Localization.LocalizationService:146: provided item type nil must be a number, string, or ItemType enum Vetrodex 22 — 4y
0
Oh i'm not sure what it is for clothing FluffySheep46209 369 — 4y
Ad

Answer this question