(Sorry for bad English)
I have create a Part and, inside the Part, i have insert this script:
local productId = 662920300
local player = game.Players.LocalPlayer
function Shop(hit)
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end
script.Parent.Touched:connect(Shop)
But i have this error in the Output ->
MarketplaceService:PromptProductPurchase() player should be of type Player, but is of type nil
How i can fix this problem? (When people touch the Part, the PromptProductPurchase is triggered)
And after this... i need to remove this part after the purchase is complete from the world (or just transfer the Part in the ReplicatedStorage)

1 comment
Localscript's only run when they're a descendant of a Player (including their character) and in ReplicatedFirst. Not in a part in workspace