Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont marketplace service work?

Asked by
PWNTART 33
8 years ago

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)
0
Is it a buy button? iNicklas 215 — 8y

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago

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
Oh that makes sesne...thats why it works when you have a click detector but not this...thx PWNTART 33 — 8y
Ad

Answer this question