Problem with in game purchase of UGC limited

  1. What do you want to achieve? Fix error with purchasing a in game UGC limited

  2. What is the issue? Getting this error :
    image

  3. What solutions have you tried so far? Tried a different place with new ID from original, didn’t work

local button = script.Parent
local market = game:GetService("MarketplaceService")
local id = <putting item id here>
local player = game.Players.LocalPlayer
button.MouseButton1Click:Connect(function()
	market:PromptPurchase(player,id)
end)

Using a button gui and a local script
image
and yes the game is public with 3rd party sales active.
the prompt to buy pops up and once you click purchase it gives the error

1 Like

I’m assuming this is a script issue? any help appreciated

5 Likes

I think problem is that it’s in LocalScript

3 Likes

do you know how I could make it work on a normal script? like maybe using a click detector?

2 Likes

sorry don’t really know how to script just trying to get this hat working lol

2 Likes

What the hell does “something went wrong” even mean? How is any developer supposed to debug this problem? This has got to be one of the dumbest things I’ve seen from Roblox in a while.

3 Likes

:man_shrugging: wish i knew lol, it would be helpful to give at least an error code.

2 Likes

UGC Limiteds can only be sold to players via Server scripts, if they are in-experience.

2 Likes

Yes it is in experience, I’m trying to make it work rn but my lackluster scripting skills are holding me back xd

1 Like

if you, or anyone for that matter could point me in the right direction id appreciate it, tried making a click detector part bring the prompt up but I just cannot make it work.

1 Like

Was it a newly released free UGC limited? That’s the error that appears on the website where it is entirely sold out even if visually on your end it is still in stock, just due to people buying it very quick

1 Like

no its a 100 stock @500r each, none have sold

1 Like

Try using a proximityprompt

(soz if code wacky i wrote it on mobile)

ProximityPrompt.Triggered:Connect(Player)
— do prompt here
end)

1 Like

where do i put that? on a script inside a part in the workspace? sorry im honestly clueless lol

1 Like

Make a part, add the object ProximityPrompt, place script inside of proximityprompt

local ProximityPrompt = script.Parent

there are better ways to do this this is just the quickest route

1 Like

Try a server script instead of a local script. I think I recall something about that from ages ago.

1 Like

Your issue, as stated by other developers above is that you cannot prompt UGC limits in local scripts as it is a security risk. As stated in the roblox docs: " If prompting a purchase of a Limited item, the request must come from the server or the purchase fails."

You should use a remote event (and debounces while your at it) to make sure your handling it correctly. Something like this should work:

Local script:

local button = script.Parent
local RemoteEvent = nil -- replace with pathway

button.MouseButton1Click:Connect(function()
	 RemoteEvent:FireServer()
end)

Server Script:

local RemoteEvent = nil -- replace with pathway
local market = game:GetService("MarketplaceService")
local id = <putting item id here>
local WhoCanBuyIt = {}

game.Players.PlayerAdded:Connect(function(plr) 
     task.wait(65) 
     table.insert(WhoCanBuyIt, plr.Name)
end)

market.PromptPurchaseFinished:Connect(function(plr, AssetID, DidTheyBuyIt)
     if AssetID == id and DidTheyBuyIt == true then 
         table.remove(WhoCanBuyIt, table.find(WhoCanBuyIt, plr.Name))
    end
end)

RemoteEvent.OnServerEvent:Connect(function(plr) 

  if table.find(WhoCanBuyIt, plr.Name) == nil then return end

  market:PromptPurchase(plr,id)
end)

Edit: fixed an error in my script

Edit 2: Made my debounce system account for the 60 second limitation placed on limited UGCs

2 Likes

I am also literally having the same issue right now.

Thank you for your lengthy reply, Trying to make this work with a Proximity Prompt but I’m having troubles with “replace with pathway” What exactly would the pathways be if i have the part with the proximity prompt & local script in the workspace and the server script in “ServerScriptService”

Replace with pathway is for the remote event. The remote event is an instance and so you need to make one. Often they are patented to replicated storage and given a unique name. An example of this pathway may be:

game.ReplicatedStorage.GiveLimitedItem

Where GiveLimitedItem is my Remote Event unique name. All your doing is giving the script where it exists so it can be used.

If your wanting to do this with a proximity prompt, then change the local script to:


local ProximityPrompt = nil —Place with pathway that mentions your Proximity Prompt

local RemoteEvent = nil —Replace with pathway to remote event

ProximityPrompt.Triggered:Connect(Player)
     if Player == game.Players.LocalPlayer then
          RemoteEvent:FireServer() 
     end
end)

And put this local script in StarterPlayer < StarterPlayerScripts