Free UGC Limited is not adding to Inventory

Me and my team, is not able to claim our own free UGC limited.

Here’s our item in the marketplace, everything seems fine here

When trying to claim the limited

Item Settings

Here’s our script:

local ITEM_ID = 15761722167
local GROUP_ID = 33454444

local MarketplaceService = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer

local l1 = plr:WaitForChild("leaderstats")
local v1 = l1:WaitForChild("rebirths")

local l2 = plr:WaitForChild("leaderstats")
local v2 = l1:WaitForChild("strength")

local l3 = plr:WaitForChild("leaderstats")
local v3 = l1:WaitForChild("coins")

script.Parent.MouseButton1Click:Connect(function()
	if plr:IsInGroup(GROUP_ID) and v1.Value >= 2 and v2.Value >= 10000 and v3.Value >= 20 then
		local success, doesPlayerOwnItem = pcall(MarketplaceService.PlayerOwnsAsset, MarketplaceService, plr, ITEM_ID)

		if success and not doesPlayerOwnItem then
			MarketplaceService:PromptPurchase(plr, ITEM_ID)
		else
		end
	else
	end
end)

1 Like

PromptPurchase (or any other purchases) must be made by a Server Script, not a Local Script. Use a RemoteEvent to send the Item Id to the Server

-- Create A remoteEvent
local RemoteEvent = --path to RemoteEvent
script.Parent.MouseButton1Click:Connect(function()
	if plr:IsInGroup(GROUP_ID) and v1.Value >= 2 and v2.Value >= 10000 and v3.Value >= 20 then
		local success, doesPlayerOwnItem = pcall(MarketplaceService.PlayerOwnsAsset, MarketplaceService, plr, ITEM_ID)

		if success and not doesPlayerOwnItem then
			RemoteEvent:FireServer(ITEM_ID)
		else
		end
	else
	end
end)

Server Script:

local RemoteEvent = -- Path To RemoteEvent
local MarketplaceService= game:GetService("MarketplaceService")
RemoteEvent.OnServerEvent:Connect(function(player, ITEM_ID)
	MarketplaceService:PromptPurchase(player, ITEM_ID)
end)
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.