I am trying to make a system where when a player buys a developer product, a message appears saying “(player who bought the dev product) has bought a developer product!”
But with the current scripts I am using, I keep getting the error
invalid argument #3 (string expected, got nil)
I tried to find a tutorial on how to make something like this but I could not find one.
Here is the script that detects when a player bought a developer product:
local MPS = game:GetService("MarketplaceService")
MPS.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == 1073754052 then
local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
game.ReplicatedStorage.ProductBought:FireAllClients()
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
end
Here is a local script that is supposed to send the message:
game.ReplicatedStorage.ProductBought.OnClientEvent:Connect(function(player)
script.Parent.Text = player
script.Parent:TweenPosition(UDim2.new(0.05, 0, 0, 0, "Out", "Sine", 1))
wait(5)
script.Parent:TweenPosition(UDim2.new(0.05, 0, -1, 0, "Out", "Sine", 1))
end)
If anyone knows how to fix this, please let me know. Anyway, thank you for your time!