Getting an error when trying to prompt the player w/ a purchase?
Asked by
5 years ago Edited 5 years ago
Code I have so far:
1 | local button = script.Parent |
2 | local ProductID = 607020275 |
3 | local Player = game.Players.LocalPlayer |
5 | button.MouseButton 1 Click:Connect( function () |
6 | game:GetService( "MarketplaceService" ):PromptProductPurchase(Player.UserId, ProductID) |
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:
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local ProductID = 607020275 |
04 | MarketplaceService.ProcessReceipt = function (receiptinfo) |
05 | for i, player in ipairs (game.Players:GetChildren()) do |
06 | if player.userId = = receiptinfo.PlayerId then |
07 | if receiptinfo.ProductId = = ProductID then |
08 | game:FindFirstChildWhichIsA( "Humanoid" ) |
10 | Humanoid.JumpPower = 100 |
Could someone please address the script's issue?