How do functions work? (roblox)

local dss = game:GetService("DataStoreService")
local donation = dss:GetOrderedDataStore("Donations")
local Mps = game:GetService("MarketplaceService")

Mps.ProcessReceipt = function(receiptInfo)
	print("proceeding")
	local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if plr then
		local robux = donation:GetAsync(plr)
		if robux == nil then
			robux = 0
		end
		print("processed, and saving. (amount = " .. robux + receiptInfo.CurrencySpent .. ")")
		donation:SetAsync(plr, robux + receiptInfo.CurrencySpent)
	end	
end

hey so it works, however it fires multiple times when mulitple things are bought. For example when I click on one of the donates it fires the code once, however when I click on donate again on the same one it plays it twice at the same time. The amount that it plays at the same time increases by one everytime the code is launched

1 Like

I’m not sure I understand your issue here.

1 Like

Don’t think too hard or your head will hurt. I understand you don’t know how processed events work for marketplaceservice and it’s fine. I suggest you start learning how properties of items in workspace work. I know it’s hard for you so maybe you should switch to building?

1 Like

Right back at ya. You can go figure it out yourself if you’re just going to be rude. We don’t volunteer our time here for you to be troll us. If you’ve got a question, be polite and make it easy for us to find the crux of the issue.
Good luck with your script.

1 Like

I agree with Jarod, Devforum is not a place to bully people. You were the one asking for help, not Jarod. Can’t believe a Programmer would even say that kind of thing.

2 Likes

I just said I figured it out myself lmao???

or animating, building is also very hard
and animating is the easiest off all than clothing designing which isnt in development, so ignore that

telling people to switch is kinda forceful just because its hard, doesnt mean you gotta give up on it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.