Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Model Selling Script Broken?

I have a script to sell a person my loader module but I get this error:

http://prntscr.com/8b63rt

Script:

script.Parent.MouseButton1Down:connect(function(Player)
	game:GetService("MarketplaceService"):PromptPurchase(Player, 259858254)
end)

This is in a TextButton in a SurfaceGui.

2 answers

✓ Accepted answer

My bad.

Surface GUIs are weird.. The ROBLOX wiki uses this:




local buyButton = game.Workspace.--Get the surface GUI
local productId = ID


buyButton.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, 
end)

2 comments

0

Did you not read that this is in a SurfaceGui in a part?

0

Sorry, updated answer

The MouseButton1Down event has two arguments : the X vector, and the Y vector. There is no player Argument, you could covert the player by using the PlayerAdded event.

game.Players.PlayerAdded:connect(function(Player)
	-- script
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.