Function runs more than once, please help!

So in my script I use a for loop to get the buttons I want, and when you click the button a function is supposed to run. The function runs first 1 time, next time I click it then it runs 3 times, then 6 and so on. This is really annoying and at first I thought it was the for loop so I tried removing it to test but nothing changed, I haven’t tried using collectionservice but I’ll probably try that as well. Keep in mind this works fine on the client, the problem only appears when the script connects with the server.

This is a part of the scrip.t

for _,v in pairs(MainUI:GetDescendants()) do
		if v:IsA("ImageButton") or v:IsA("TextButton") then
				if v:FindFirstChild('Purchase') then
					if not PurchaseDeboucne then

Could you show more code? Where is this for loop located? Also, can you ensure that PurchaseDeboucne is spelled the way you intended it to?

The for loop is located in a local script in the playergui

This is the server script

function Receipt(Info)
	local PlayerID = Info.PlayerId
	local ProductId = Info.ProductId
	local Player = Players:GetPlayerByUserId(PlayerID)
	return Enum.ProductPurchaseDecision.NotProcessedYet

MarketPlaceService.ProcessReceipt = Receipt

And what do you mean by spelled it the way I intended it to? I didn’t misspell anything.

I was asking about the LocalScript. I was wondering if you could show the rest of the LocalScript. Your for loop code looks completely fine, I’m just wondering if that segment of code is being run multiples times.