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

How to prompt player to purchase shirt when click on button?

Asked by 4 years ago

Hi, so I'm making a GUI where if a player clicks it, it will ask them if they want to buy a shirt. Here is the script I already have.

local shirtId = 897595758

script.Parent.Mousebutton1click:connect(function()
       game:GetService('MarketplaceService'):PromptPurchase(player, shirtId)
end)

I'm not sure what's wrong, but the (player is underlined in red so that's an error. Does anyone know what I'm missing? Any help is appreciated, thank you!

0
try to put player in the parenthesis in the function quinzt 201 — 4y
1
If this is in a LocalScript, you can't use just player. You'd have to use game.Players.LocalPlayer. If this is in a regular Script, then well change it to a LocalScript. AntiWorldliness 868 — 4y

1 answer

Log in to vote
1
Answered by
quinzt 201 Moderation Voter
4 years ago

so i think its underlined because the script has no idea what your talking about because you havent stated it in a function earlier. To fix this, just put player in the parenthesis in the function then the script can know what u mean

Ad

Answer this question