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: Player Points.

Previous Thread :: Next Thread 
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:15 AM
I was just wondering, do player points take a while to be awarded after a script in the game awards them? My script gave them to me but I don't have them yet.
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:21 AM
~Bump~
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:27 AM
local MarketplaceService = game:GetService("MarketplaceService")
local PP100, PP50, PP20 = 20077009, 20077028, 20077050
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
PS = game:GetService("PointsService")
budget = PS:GetAwardablePoints()

MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
if PurchaseHistory:GetAsync(playerProductKey) then
return Enum.ProductPurchaseDecision.PurchaseGranted --We already granted it.
end
-- find the player based on the PlayerId in receiptInfo
for i, player in ipairs(game.Players:GetPlayers()) do
if player.userId == receiptInfo.PlayerId then
-- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product)
if receiptInfo.ProductId == PP100 then
if budget >= 100 then
PS:AwardPoints(player.userId, 100)
end
print(budget.." points remaining")
elseif receiptInfo.ProductId == PP50 then
if budget >= 50 then
PS:AwardPoints(player.userId, 50)
end
print(budget.." points remaining")
elseif receiptInfo.ProductId == PP20 then
if budget >= 20 then
PS:AwardPoints(player.userId, 20)
end
print(budget.." points remaining")
end
end
end
-- record the transaction in a Data Store
PurchaseHistory:SetAsync(playerProductKey, true)
-- tell ROBLOX that we have successfully handled the transaction (required)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

No errors.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jun 2014 10:31 AM
WHERE'D YOU GET THAT SCRIPT TO HACKER!!!
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:32 AM
Originally from the wiki, I modified it though.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
09 Jun 2014 10:32 AM
@war
wait, are you saying thats YOUR script??
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jun 2014 10:34 AM
Uhhh I refuse to take this any farther.
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:34 AM
Can anyone help? I can purchase the dev product fine, its just the points that don't work.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
09 Jun 2014 10:35 AM
War is a nooby scripter.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
09 Jun 2014 10:36 AM
Looks like I got some new competition...



★ Most viewed thread of all time, please support me by F5'ing it! http://www.roblox.com/Forum/ShowPost.aspx?PostID=136340077 ★
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:38 AM
Guys, virtual homicide isn't beyond my reach. Can any of you actually help me?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jun 2014 10:38 AM
I'm not a Nooby scripter -_-
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
09 Jun 2014 10:39 AM
Who's your competition ForeverDev?
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
09 Jun 2014 10:40 AM
@Forever,

I hate this business.
Couldn't everyone who does this just make really good gamepasses?
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
09 Jun 2014 10:41 AM
alright let me clean this up for you. You don't need to check the budget, because if the player buys a developer product, you know there are enough points.

local MarketplaceService = game:GetService("MarketplaceService")
local PP100, PP50, PP20 = 20077009, 20077028, 20077050

MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetPlayers()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == PP100 then
PS:AwardPoints(player.userId, 100)
elseif receiptInfo.ProductId == PP50 then
PS:AwardPoints(player.userId, 50)
elseif receiptInfo.ProductId == PP20 then
PS:AwardPoints(player.userId, 20)
end
end
end
end

return Enum.ProductPurchaseDecision.PurchaseGranted
end




★ Most viewed thread of all time, please support me by F5'ing it! http://www.roblox.com/Forum/ShowPost.aspx?PostID=136340077 ★
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:47 AM
I'm still not receiving any points.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
09 Jun 2014 10:48 AM
Did you define PS as

local PS = game:GetService("PointsService") ?



★ Most viewed thread of all time, please support me by F5'ing it! http://www.roblox.com/Forum/ShowPost.aspx?PostID=136340077 ★
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:50 AM
*Face palm*
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
09 Jun 2014 10:51 AM
It's okay boi. I had so much trouble with a script only to find out I used LocalPlayer in a global script.
Report Abuse
WhiteRoseDeath is not online. WhiteRoseDeath
Joined: 01 May 2014
Total Posts: 163
09 Jun 2014 10:53 AM
Thats pretty amusing. Ok, now I just need to add a debounce and I'm sorted.
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