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

Prompt Purchase isn't working?

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)

1 comment

0

I Have the same problem

1 answer

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)

2 comments

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

0

Oh i'm not sure what it is for clothing

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