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

Prompt shirt once player clicks?

I'm learning to script and trying my best but I've never done this before. How can I make it so when the player clicks the Gui Button inside of a shop, it prompts the shirt so they can buy it?

local itemID = 5088846045
local player  = game.Players:FindFirstChild("Humanoid")

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

1 answer

✓ Accepted answer

You were really close!

local itemID = 5088846045
local player  = game.Players.LocalPlayer

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

Make sure that this is in a local script.

You were trying to get the player's humanoid from their player, not character. Nonetheless, this is not necessary. All you have to alter is getting the LocalPlayer, and using that to define player.

I hope this helps you!

2 comments

0

Oh I see! Thanks a lot!!!

0

No problem!

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