I'm developing a game where players can buy in-game cash for Robux. I used a model that has SurfaceGui buttons that are supposed to prompt the player to buy a dev product. However, in Studio and in-game pressing the button does not prompt anything.
Here is my code for one of the buttons:
local buyButton = script.Parent local productId = 567187672 local mps = game:GetService("MarketplaceService") function getPlayerById(id) for i,v in pairs(game.Players:GetPlayers()) do if v.userId == id then return v end end end buyButton.MouseButton1Down:connect(function() mps:PromptProductPurchase(game.Players.LocalPlayer, productId) end) mps.ProcessReceipt = function(info) local plr = getPlayerById(info.PlayerId) if plr and plr:FindFirstChild("leaderstats") and plr.leaderstats:FindFirstChild("Cash") then plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 1000 end end