generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How to you make a script award a player what they buy

Previous Thread :: Next Thread 
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
13 Jun 2014 01:42 PM
Like, I'm adding an in-game points shop to my game so when players spend, say 10 robux for 15 points, it uses the :PromptPurchase method to have them but a Developer Product for the price of R$ 10, but how to I make it give them the points after they buy it? P:
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
13 Jun 2014 01:50 PM
:L
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
13 Jun 2014 02:07 PM
u script it
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
13 Jun 2014 02:10 PM
I was kinda of asking for the script -_-
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
13 Jun 2014 02:19 PM
They help not make
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
13 Jun 2014 02:20 PM
Well they aren't helping at all
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
13 Jun 2014 02:20 PM
i am i just told u the answer

question is SOLVEd
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
13 Jun 2014 02:21 PM
Okay let me rephrase my fricking question

What's the script to give players the points after they purchase them
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
13 Jun 2014 02:23 PM
look in free models bcus im not making one for u
Report Abuse
SheepGoesBaa is not online. SheepGoesBaa
Joined: 21 Nov 2009
Total Posts: 2172
13 Jun 2014 02:37 PM
I mean, this guy has a point. You can't just learn to script something specific. If you know how to script, you know how to script everything essentially and it's just a matter of learning some small things at that point. My advice for you is to either learn how to script or look in free models.
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
13 Jun 2014 02:45 PM
Alright
http://wiki.roblox.com/index.php?title=Points_tutorial
Look at it and try and find the line that gives
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
13 Jun 2014 03:16 PM
I'm not talking about player points -_-
Report Abuse
Aisoc is not online. Aisoc
Joined: 08 Jun 2013
Total Posts: 412
13 Jun 2014 03:22 PM
yeah i guess its possible you should look at vip doors and find line... bup bup bup

exampe if u want to pass vip door you need to have vip t-shirt so you need find that line ives u pass the door than change into badge and every time player join the game will check your badge or whatever and award player.

my idea
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
13 Jun 2014 03:25 PM
Here, I made a script just today. It's a developer product API:

local MarketplaceService = game:GetService("MarketplaceService")
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("DeveloperProductPurchaseHistory")
local products = {
["10 Robux Donation"] = {
["ProductId"] = 20113606,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 100
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["25 Robux Donation"] = {
["ProductId"] = 20113615,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 250
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["50 Robux Donation"] = {
["ProductId"] = 20113619,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 500
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["100 Robux Donation"] = {
["ProductId"] = 20113628,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1000
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["500 Robux Donation"] = {
["ProductId"] = 20113706,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 5000
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["1000 Robux Donation"] = {
["ProductId"] = 20113717,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 10000
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["10 Tix Donation"] = {
["ProductId"] = 20113638,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 10
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["25 Tix Donation"] = {
["ProductId"] = 20113644,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 25
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["50 Tix Donation"] = {
["ProductId"] = 20113649,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 50
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["100 Tix Donation"] = {
["ProductId"] = 20113653,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 100
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["500 Tix Donation"] = {
["ProductId"] = 20113711,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 500
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
},
["1000 Tix Donation"] = {
["ProductId"] = 20113720,
["Action"] = function(player, product_Id)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1000
print(player.Name .. " has purchased the " .. MarketplaceService:GetProductInfo(product_Id, Enum.InfoType.Product).Name .. " product")
end
}
}

function printProducts()
local currentNumI = 0
for ind, val in pairs(products) do
currentNumI = currentNumI + 1
print(currentNumI .. ": " .. ind .. " (" .. val["ProductId"] .. ")")
end
end

MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
if PurchaseHistory:GetAsync(playerProductKey) then
return Enum.ProductPurchaseDecision.PurchaseGranted
end

for i, player in ipairs(game.Players:GetPlayers()) do
if player.userId == receiptInfo.PlayerId then
for ind, val in pairs(products) do
if val["ProductId"] == receiptInfo.ProductId then
val["Action"](player, receiptInfo.ProductId)
end
end
end
end

PurchaseHistory:SetAsync(playerProductKey, true)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

printProducts() -- Lists all developer products in the product dictionary in the format of: Numeral Index: Product Name (Product Id)


Change the product list to your needs.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
13 Jun 2014 03:27 PM
Also, I recommend putting it into the server script service. And the products dictionary is the ONLY thing you need to change.

Note: Action is the function you want to run when a player successfully buys the product. (Clicks the ok button to close the window)
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
13 Jun 2014 03:28 PM
And you can delete all of the other products in the product dictionary. They were just showing the format.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
13 Jun 2014 03:35 PM
Hope this helps! :)
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
13 Jun 2014 07:56 PM
So all I change is

["50 Robux Donation"] = {
["ProductId"] = 20113619,

?

And put the ENTIRE script in a script in script service?
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
14 Jun 2014 01:13 PM
Yes. And like I said, you can delete all of the other products in the list. Those were just all of my products in the game I got it from.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
14 Jun 2014 01:14 PM
And also change the Action key to your needs too. The action key is just the function that runs when a player buys it after they click the ok button which appears after they purchase something.
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
14 Jun 2014 01:15 PM
just learn the processreceipt callback, a lot easier if you learn what it does..
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
14 Jun 2014 01:17 PM
Yeah, I didn't even know that it existed and then I made a api in an hour...
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
14 Jun 2014 01:18 PM
Idk what you mean D:

I have 4 different buttons to buy in-game points with

Idk what all to change on the script :L
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
14 Jun 2014 01:21 PM
Give me the names and the product ids of the 4 developer products and I will re post what you need to put in
Report Abuse
Irradiant is not online. Irradiant
Joined: 31 May 2012
Total Posts: 56114
14 Jun 2014 01:22 PM
Okay

I haven't added the Dev Products yet, so can you edit the script to where there are 4 slots for me to just plug in the names of them and the ID of them?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image