Hey! So my script is currently not giving me the snowball, after purchasing, I know the script is a bit messy here, but the objective is to get it to work. Heres the code I made:
This is the error Im getting:
01:53:01.914 DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = player_66904563_product_1150957679 - Studio
Code:
local player = game.Players.LocalPlayer
local Proximity = workspace.Proxapart.ProximityPrompt
local devproductid = 1150957679
local player = game.Players.LocalPlayer
local Player = game.Players.LocalPlayer
local Tool = game:GetService("ReplicatedStorage").Snowball:Clone()
local productId = 1150957679
Proximity.Triggered:Connect(function(player)
game:GetService("MarketplaceService"):PromptProductPurchase(player, devproductid)
end)
local function processReceipt(receiptInfo)
if receiptInfo.ProductId == 1150957679 then
local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
Tool.Parent = Player.Backpack
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
this script doesn’t use datastores, so that error is from something else
you need to use a server script to handle marketplace stuff, I can’t tell if this is or isn’t a local script rn, but you’d need to remove the 2 lines you use LocalPlayer
you need to clone the snowball each time someone buys it right before setting the Parent, not at the top of the script
you need to connect the function, processReceipt to marketplaceservice, there’s an example here
when getting the player’s backpack with player.Backpack, use player because you set the player that bought the product to the variable player
Also note: If you game has more than just this one developer product, either this or the other developer product script won’t work, you need them combined
and the 5 problems above are just what I saw, there might be more
local Proximity = workspace.Part.ProximityPrompt
local devproductid = 1150957679
local player = game.Players.LocalPlayer
local MPS = game:GetService("MarketplaceService")
local Tool = game:GetService("ReplicatedStorage").ClassicSword
Proximity.Triggered:Connect(function(player)
game:GetService("MarketplaceService"):PromptProductPurchase(player, devproductid)
print("Prompted")
end)
MPS.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == 1150957679 then
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
Tool:Clone().Parent = player.Backpack
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
You shouldn’t give the player a sword through the client. Use ServerStorage Instead of ReplicatedStorage when you don’t need the client to use something also make some research before posting, there are topics related to your same problem here and the wiki.