Code I have so far:
local button = script.Parent local ProductID = 607020275 local Player = game.Players.LocalPlayer button.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(Player.UserId, ProductID) end)
I am not too sure why I am getting the error: Players.BloxburgAccountBart.PlayerGui.ProductsGUI.MainFrame.XDmodeButton.Script:6: attempt to index upvalue 'Player' (a nil value).
Why is it a nil value?
Idk if this other stuff may help but I'll give it anyways:
local MarketplaceService = game:GetService("MarketplaceService") local ProductID = 607020275 MarketplaceService.ProcessReceipt = function(receiptinfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptinfo.PlayerId then if receiptinfo.ProductId == ProductID then game:FindFirstChildWhichIsA("Humanoid") if ( Humanoid ) then Humanoid.JumpPower = 100 end end end end end
Could someone please address the script's issue?
For purchasing, this should work
Purchase script in ServerScriptService
local mps = game:GetService('MarketplaceService') local credits = --purchase id mps.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == credits then local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId) player.Coins.Value = player.Coins.Value + 50 end return Enum.ProductPurchaseDecision.PurchaseGranted end
Button Script
local mps = game:GetService('MarketplaceService') local id = --purchase id script.Parent.MouseButton1Click:Connect(function() mps:PromptProductPurchase(game.Players.LocalPlayer, id) end)