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

Why wont marketplace service work?

Im using this for a surface gui and it wont work.

local Shirt = 109854904

script.Parent.MouseButton1Click:connect(function(player)
	game:GetService("MarketplaceService"):PromptPurchase(player, Shirt)
end)

1 comment

0

Is it a buy button?

1 answer

✓ Accepted answer

Your Problem

The MouseButton1Down event does not return the player that clicked - it returns the x and y coordinates of where the mouse was found when the gui was clicked. You need to define the player as game.Players.LocalPlayer!


Code

local Shirt = 109854904
local plr = game.Players.LocalPlayer --Define the player

script.Parent.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(player, Shirt)
end)

1 comment

1

Oh that makes sesne...thats why it works when you have a click detector but not this...thx

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