Hello, I have a feature in my game where you can buy a Dev Product to troll a player that you choose (each troll is its own product), and Im using ProcessReceipt to make sure the player bought the product ( as is standard practice).
When it fires the callback and if you bought the product it fires a bindable event to my Troll server script that will do all the functions. Only thing is when I prompt the purchase the only info I can send is related to the product itself, so all the extra info (troll name, player you selected) is lost so I cant actually run the troll.
In my local script when you choose a troll and a player it fires a remote event with said data and that server script that picks up the event prompts the purchase
buyTroll:FireServer(choicePlayer, selectedTroll) --local
buyTroll.OnServerEvent:Connect(function(player, choicePlayer, selectedTroll)
--print(player, choicePlayer, selectedTroll)
local devId = list.RobuxProducts.Trolls[selectedTroll]
MarketplaceService:PromptProductPurchase(player, devId)
end)
–Server Troll Script
In my process purchase server script
MarketplaceService.ProcessReceipt = function(receiptInfo, extraInfo)
--other products
local trollList = List.RobuxProducts.Trolls
for name, id in trollList do
if productId == id then
ReplicatedStorage.Events.Players.Hiders.trolls:WaitForChild("FireTroll"):Fire(name) --fire to troll script
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
The issue here is now that once the receipt is processed successfully it lost all of the data needed like the player selected.
trollActivated.Event:Connect(function(trollName)
--only trollName can be sent
end)
I know this is quite long but I have no idea how im supposed to get said player that was chosen in the buyTroll event. If anyone has any idea please let me know, thanks.