Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How do I change the MarketplaceService ID's to different ID's to get me money? [closed]

Asked by
Zequew 0 Donator
8 years ago
local Service = game:GetService("MarketplaceService");
local SellItems = {
 ["Knife"]  = 24441926; -- If IDHERE is left 0, the item will be free.
 ["Mk-17"] = 24442025;
 ["Uzi"] = 24442001;
 ["Explosive Vest"] = 24441966;
}

for Name,Item in pairs(SellItems) do
 local Choice = script.Choice1:Clone();
 Choice.Name = Name
 Choice.UserDialog = Name
 Choice.ResponseDialog = "Let's not tell the police about this eh?";
 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)

How do I change the ID's uptop to a different ID that would give me money?

Closed as Not Constructive by alphawolvess, User#5978, and Shawnyg

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 8 years ago

Gathering by the ID's at the top and a quick search on roblox, I believe that they are Developer Products (If not, sorry!) You would have to create your own of these.

Developer Product

Developer Products are awesome, as rather than with some Gamepasseswhere you need to join a new server or rejoin the game Developer Products work instantly, and the player can buy it an infinite number of times.

Here's how to create one:

Go to the configure page for your place. On the configuration page, there is a tab with the text "Developer Products". Click the button that says "Create new". On the developer product creation page, you must fill in all of the necessary boxes, and then click create.

Function

So with the script you've given is for is for items, and you want to be using "Money", so there are a few things you would want to do. Firstly you are going to need a method for the player to purchase this, firstly I suggest creating some sort of Gui with a TextButton, here insert a LocalScript.

So now we have the TextButton, but we need to activate it, so we will be using a simple Clicked function. It is important that you put the LocalScript as a Child of the TextButton or change the path of the button script.Parent is what it is currently set to.

script.Parent.MouseButton1Click:connect(function() 

The Developer Product ID

Once you've created your Developer Product and set a price for it, you will need to get the ID of it, this will in the same place that you created it with the ID next to it and it's name, copy that and paste it under:

local DevProductID = 0 -- Set this to the Developer Product you want the player to buy.

Conclusion

I've tried to keep it as simple as possible for you by adding variables at the top so you don't need to edit anything apart from the Player's location and on Line x where it says:

Player.leaderstats.Money.Value = Player.leaderstats.Money.Value + AddMoneyAmount

change the Money to your in-game currency name.

local Marketplace = game:GetService("MarketplaceService")
local Player = script.Parent.Parent.Parent.Parent

local DevProductID = 0 -- Set this to the Developer Product you want the player to buy.
local AddMoneyAmount = 100 -- Amount of money that will be added if the player buys it.

script.Parent.MouseButton1Click:connect(function() 
    Marketplace:PromptProductPurchase(Player, DevProductID)
    Marketplace.ProcessReceipt = function(receiptInfo)
        if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == Player.userId then
                Player.leaderstats.Money.Value = Player.leaderstats.Money.Value + AddMoneyAmount
        end 
    end
end)
0
How do I earn the money from what people buys them? Zequew 0 — 8y
0
When you create a Developer Product you will be asked to set a price in R$, you will recieve the R$ every time your Developer Product is sold. Please accept my answer if it helped. theSkyWars 45 — 8y
Ad