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

Model Selling Script Broken?

Asked by 8 years ago

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

Log in to vote
0
Answered by
ItsMeKlc 235 Moderation Voter
8 years ago

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)
0
Did you not read that this is in a SurfaceGui in a part? TypicalModerator 110 — 8y
0
Sorry, updated answer ItsMeKlc 235 — 8y
Ad
Log in to vote
0
Answered by
rexbit 707 Moderation Voter
8 years ago

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)

Answer this question