I want to make it so that when a player clicks on a TextButton under SurfaceGui that it prompts the purchase of a developer product
I keep getting the same error in Output:
MarketplaceService:PromptProductPurchase() player should be of type Player
I don’t know why this keeps happening and have looked at multiple topics.
This is the script I’m using.
local Player = game:GetService('Players').LocalPlayer
local MarketplaceService = game:GetService('MarketplaceService')
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(Player,1583342669)
end)
You need to put the SurfaceGui inside of a ScreenGui. The ScreenGui needs to be inside of the StarterGui. Then set your SurfaceGui Adornee to the part you want the SurfaceGui to be on. Then put a LocalScript in your TextLabel.
Put this in your LocalScript:
local productId = 1583342669
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)