Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Marketplace service not giving right amount!?

So in my game, I have dev products, these dev products will give your currency. In my first dev product it will give 100K currency, but when I test it, it gives 100. Can anybody solve this issue?

Script(Normal Script)

local mps = game:GetService("MarketplaceService")
local id = 455366694 
local amountGiven = 100,000

mps.ProcessReceipt = function(receiptInfo)
	for i,player in pairs(game.Players:GetPlayers()) do
		if player.UserId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == id then
				local leaderstats = player:WaitForChild('leaderstats')
				if leaderstats then
					local boost = leaderstats:WaitForChild('Boost')
					if boost then
						print(boost.Value)
						print(amountGiven)
						print(boost.Value + amountGiven)
						boost.Value = boost.Value + amountGiven
					end
				end
			end
		end
	end
end

1 comment

0

Dont put a "," instead use just 0's (100000) (line 3)

1 answer

✓ Accepted answer

There is a VERY obvious reason why it isn't working.

Computers don't use commas when using a number that is at least one thousand because commas mean something totally different.

In Lua, commas are used to define more than one variable in one line:

local num, bool = 9, true

The variable "num" gets assigned to 9 and "bool" gets assigned to true.

I forgot to mention that commas are also used to put multiple parameter names in a function:

function FunctionOne(one, two)

This discussion is preserved as it was. New answers, comments, and votes are closed.