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.

6 comments
By the way, what I meant by "changing it" was about changing the script to a local script, not changing the script itself.
oh
Well i tried a local script and it didnt work. then i checked the output. Nothing. I added a print function to ALL the lines to see where the code stops. Still, nothing. Help
hmmm
It worked?
nope