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 » Scripters
Home Search
 

Re: Make this more efficient?

Previous Thread :: Next Thread 
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
06 Mar 2016 11:43 AM
[Smaller?]





local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local bloxyColaId = 32468886
local PointsToGive = 50

script.Parent.MouseButton1Down:connect(function()
local player = script.Parent.Parent.Parent.Parent.Parent
game:GetService("MarketplaceService"):PromptProductPurchase(player, bloxyColaId)
end)

game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId==32468886 then
player.leaderstats.Points.Value = player.leaderstats.Points.Value + PointsToGive
end
end
end

local playerProductKey = "p_" .. receiptInfo.PlayerId .. "_p_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
06 Mar 2016 11:45 AM
b1
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Mar 2016 11:45 AM
it's good as it is



#code R+ | local RAP = "R$438,334"; local robux = "R$8,551"
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
06 Mar 2016 11:46 AM
Is there a easy way to simply make it smaller? or even more efficient?
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Mar 2016 11:47 AM
> it's

> good

> as

> it

> is



#code R+ | local RAP = "R$438,334"; local robux = "R$8,551"
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
06 Mar 2016 11:48 AM
I know its good as it is, just trying to make it smaller... Big scripts (yes to me this is big) bother me and if I want to add more etc making it smaller is well easier...
Report Abuse
LTB4 is not online. LTB4
Joined: 05 Mar 2016
Total Posts: 298
06 Mar 2016 11:50 AM
It's good. Ask again and I will get my alt army.


-LTB4
Report Abuse
Trolololo12studio is not online. Trolololo12studio
Joined: 18 Jan 2013
Total Posts: 3175
06 Mar 2016 11:50 AM
Its good,dont make it smaller

Expect us.


Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Mar 2016 11:51 AM
ARE U AN IDIOT

THAT IS BASICALLY ALL THE INFO FOR A RECEIPT SCRIPT JFC



#code R+ | local RAP = "R$438,334"; local robux = "R$8,551"
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Mar 2016 11:52 AM
If big scripts bother you then PLEASE do not make games and just quit scripting right now.



#code R+ | local RAP = "R$438,334"; local robux = "R$8,551"
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
06 Mar 2016 11:54 AM
;-; i never said i wont use them i just said they bother me ffs
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
06 Mar 2016 12:02 PM
[Here's the updated 1. (Sorta)]



local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local bloxyColaId = 32468886
local bloxyColaId2 = 32488796
local bloxyColaId3 = 32488802
local PointsToGive = 50
local PointsToGive2 = 100
local PointsToGive3 = 500

script.Parent.Shop1Button.MouseButton1Down:connect(function()
local player = script.Parent.Parent.Parent.Parent
game:GetService("MarketplaceService"):PromptProductPurchase(player, bloxyColaId)
end)

script.Parent.Shop2Button.MouseButton1Down:connect(function()
local player = script.Parent.Parent.Parent.Parent
game:GetService("MarketplaceService"):PromptProductPurchase(player, bloxyColaId2)
end)

script.Parent.Shop3Button.MouseButton1Down:connect(function()
local player = script.Parent.Parent.Parent.Parent
game:GetService("MarketplaceService"):PromptProductPurchase(player, bloxyColaId3)
end)

game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId==bloxyColaId then
player.leaderstats.Points.Value = player.leaderstats.Points.Value + PointsToGive--1
end
if receiptInfo.ProductId==bloxyColaId2 then
player.leaderstats.Points.Value = player.leaderstats.Points.Value + PointsToGive2--2
end
if receiptInfo.ProductId==bloxyColaId3 then
player.leaderstats.Points.Value = player.leaderstats.Points.Value + PointsToGive3--3
end
end
end

local playerProductKey = "p_" .. receiptInfo.PlayerId .. "_p_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Report Abuse
Trolololo12studio is not online. Trolololo12studio
Joined: 18 Jan 2013
Total Posts: 3175
06 Mar 2016 12:03 PM
^
Its even bigger now


Expect us.


Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
06 Mar 2016 12:04 PM
^ Actually smaller* Instead of handling one per script it handles all of them.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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