So I have a script where you click a part and it prompts the purchase of a Developer Product. Here is the script:
script.Parent.MouseClick:Connect(function(player) local ID = 618642828 game:GetService("MarketplaceService"):PromptProductPurchase(player, ID) end)
But that's not what I need help with. I have this script which is supposed to teleport you when you purchase the Developer Product. It doesnt teleport me though. Can anybody tell me what ive done wrong? Please help or at least tell me what to do! Thanks! (script)
local MarketplaceService = game:GetService("MarketplaceService") local devproductid = 618642828 MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in pairs(game.Players:GetChildren()) do if player.userId ==receiptInfo.PlayerId then if receiptInfo.ProductId == devproductid then game.Players.LocalPlayer.Character.Humanoid.Torso = CFrame.new(-244, 5, 185) end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
btw when I check the output it says: -Workspace.Part.Script:8: attempt to index field 'LocalPlayer' (a nil value)
And also it a Script not LocalScript.
The problem is: LocalPlayer cannot be run on a script, only a LocalScript... So maybe changing it would be a good idea? I'm not sure what else i could tell you.