Multiple System Messages

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to have that when you donate, a system message shows up

  1. What is the issue? Include screenshots/videos if possible!

    (FOCUS ON CHAT)

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried using AI, developer hub, but couldn’t find resolutions

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

SCRIPT ONE

game.MarketplaceService.ProcessReceipt = function(pi)
	local id = pi.PlayerId
	local purchaser = game.Players:GetPlayerByUserId(id).Name
	if pi.ProductId == 1782560114 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Five")
	elseif pi.ProductId == 1782560113 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Ten")
	elseif pi.ProductId == 1782560112 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Fifty")
	elseif pi.ProductId == 1782560107 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Hundred")
	elseif pi.ProductId == 1783296760 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Thousand")
	end
end

SCRIPT TWO

game.ReplicatedStorage.DonationMessage.OnClientEvent:Connect(function(plr,arg)
	if not arg then return end
	if arg == "Five" then
		game.StarterGui:SetCore("ChatMakeSystemMessage",{
			Text = plr.." give me \u{E002}5 bubox!";
			Color = Color3.new(0,1,0);
			Font = Enum.Font.SourceSansBold;
			Size = 14,
		})
	elseif arg == "Ten" then
		game.StarterGui:SetCore("ChatMakeSystemMessage",{
			Text = plr.." give me \u{E002}10 bubox!";
			Color = Color3.new(0,1,0);
			Font = Enum.Font.SourceSansBold;
			Size = 14,
		})
	elseif arg == "Fifty" then
		game.StarterGui:SetCore("ChatMakeSystemMessage",{
			Text = plr.." give me \u{E002}50 bubox!!!!!!";
			Color = Color3.new(0,1,0);
			Font = Enum.Font.SourceSansBold;
			Size = 14,
		})
	elseif arg == "Hundred" then
		game.StarterGui:SetCore("ChatMakeSystemMessage",{
			Text = plr.." give me \u{E002}100!!!! im so hapy!!!!!";
			Color = Color3.new(0,1,0);
			Font = Enum.Font.SourceSansBold;
			Size = 14,
		})
	elseif arg == "Thousand" then
		game.StarterGui:SetCore("ChatMakeSystemMessage",{
			Text = plr.." GIVE ME \u{E002}1,000 BABAX TANK UUUUU!!!";
			Color = Color3.new(0,1,0);
			Font = Enum.Font.SourceSansBold;
			Size = 14,
		})
	end
end)

Ignore the grammar in the UI btw, it has nothing to do with the game lol

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Have you tried adding some print statements and watching for them in the Output window?

Like so:

game.MarketplaceService.ProcessReceipt = function(pi)
	
	print("pi =", pi)
	
	local id = pi.PlayerId
	local purchaser = game.Players:GetPlayerByUserId(id).Name
	
	if pi.ProductId == 1782560114 then
		
		print(purchaser, " purchased 1782560114")
		
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Five")
		
	elseif pi.ProductId == 1782560113 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Ten")
	elseif pi.ProductId == 1782560112 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Fifty")
	elseif pi.ProductId == 1782560107 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Hundred")
	elseif pi.ProductId == 1783296760 then
		game.ReplicatedStorage.DonationMessage:FireAllClients(purchaser,"Thousand")
	else
		
		warn("No matching product found.", pi)
	end
end

You can use them to figure out what is and what is not working.

it does print but when I donate again, the system message multiplies for some reason…

Can you screen capture the Output window and post it so we can see what you mean?

here:

robloxapp-20240322-2257183.wmv (1.5 MB)

Right, I see.

Can you see the Output window?

Screen Shot 2024-03-22 at 3.01.07 PM

Turn it on if it is not already visible. Then use the print commands in your script to track down the problem.

You are never returning Enum.ProductPurchaseDecision.PurchaseGranted in your ProcessReceipt callback

1 Like

oh I haven’t thought about that and I tried it and it worked, thank you!

1 Like

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