How can I make a script that works that after a user buys a developer product with the ID of 1884306040 the game will send a message every player can see saying which user bought the product?
You can use the ProcessReceipt callback to detect when a player buys a developer product, and after that loop through all the players and send send each of them a message.
Can you make a script that does that or smth?
As said above you can use the ProcesseReceipt system to detect when a sale is made on a product and use a RemoteEvent to send that Info to the server and to display a message to all clients ingame.
It’s actually pretty straight forward, here:
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
MarketplaceService.ProcessReceipt = function(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
-- loop thru players and notify them
return Enum.ProductPurchaseDecision.PurchaseGranted
end
This needs to be in a server (regular) script
I don’t think you get what I mean. I have a developer product that kills all players when bought and I want the game to send a message in the chat that everyone can see.
What I’m looking for the message to be “ has just bought the kill all product”
This is exactly what you need, when a player buys a developer product the ProcessReceipt
callback is called.
You can do the notifying/applying effects by yourself.
Edit: I just realized what you mean, check out TextChatService, also this post