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

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

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!

2 comments

0

try to put player in the parenthesis in the function

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.

1 answer

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

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