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

My developer product handler is giving me a wearde error?

Asked by 6 years ago
Edited 6 years ago

Wearde... So at first, I got an error I believe I fixed it. Please help me fix this script:
Also the error its giveing me is: ServerScriptService.BuyCash.1:26: unexpected symbol near '?'

-- setup local variables
local MarketplaceService = Game:GetService("MarketplaceService")
local productId = 236341078



-- define function that will be called when purchase finished
MarketplaceService.ProcessReceipt = function(receiptInfo) 

 -- find the player based on the PlayerId in receiptInfo
 for i, player in ipairs(game.Players:GetChildren()) do
  if player.userId == receiptInfo.PlayerId then


   -- check which product was purchased
   if receiptInfo.ProductId == productId then


   -- give them the cash
   player.leaderstats.Money.Value = player.leaderstats.Money.Value + 250   
   end
  end
 end 
 -- tell ROBLOX that we have successfully handled the transaction
 return Enum.ProductPurchaseDecision.PurchaseGranted  
end)

Also if you're going to fix it do not give me a link to the Roblox wiki or something please give me the script or tell me why this is happening and help me fix it..

0
Were not going to give you the answer, this website is mainly for helping people, not just being given a script* Jo_Bot 67 — 6y
0
This website is not to give scripts it's to help people fix them. Part of that is giveing them the script that fixed that error or whatever.. appleprogamer_59 29 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
  1. That's not your script
  2. Please spell better

I found what's causing the problem. On line 8 it says (in your code)

MarketplaceService.ProcessReceipt = function(receiptInfo)

The equal symbol ("=") never is in the start of a function. Fix that line to this:

MarketplaceService.ProcessReceipt:connect(function(receiptInfo)

Read the link below about functions: (I know you sad no Wiki links but it's gonna help you)

Wiki Article About Functions

~Chez_Guy, Dev.

Ad

Answer this question