I have a script that gives you a tool once you buy a developer product from an NPC through the dialog, it worked last month and now that I made minor edits to it, it doesn't want to work. Not sure what's wrong with it. The developer products are set up and everything, so are the ID's. The game doesn't give me back an error report either, it just says "An error has occurred please try again later". Not sure what to do.
local Service = game:GetService("MarketplaceService");
local SellItems = {
["Knife"] = 24271258;
["TrenchGun"] = 24271246;
["Mk-17"] = 24271315;
["Uzi"] = 24271280;
}
for Name,Item in pairs(SellItems) do
local Choice = script.Choice1:Clone();
Choice.Name = Name
Choice.UserDialog = Name
Choice.ResponseDialog = "Don't give away my location!";
Choice.Parent = script.Parent;
end
function GetChoice(Name)
for _,ID in pairs(SellItems) do
if _ == Name then
return _,ID
end
end
return
end
script.Parent.DialogChoiceSelected:connect(function(Player, Choice)
local s,e = coroutine.resume(coroutine.create(function()
if SellItems[Choice.Name] and Player then
local Choice,ID = GetChoice(Choice.Name)
if Player.Character and Choice and ID then
if not Player.Character:findFirstChild(Choice) then
if Player:findFirstChild("Backpack") then
if not Player.Backpack:findFirstChild(Choice) then
print("Does not own");
Service.ProcessReceipt = (function(receiptInfo)
local Gun = game.Lighting:WaitForChild(Choice):Clone()
Gun.Parent = Player.Backpack;
Service.ProcessReceipt = nil;
end)
Service:PromptProductPurchase(Player,ID);
end
end
end
end
end
end))
if not s then Instance.new("Hint",game.Workspace).Text = "Error: "..e end
end)

1 comment
Well, well, well.. We meet again.. Do you own those developer products? If not and it's your game, it'll error.