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

Someone explain please? [MarketplaceService]

So I have this script that allows players to purchase things by clicking on a gui. I just wanna know some things in the code that I have absolutely no sense of.

itemID= 123456789
player = script.Parent.Parent.Parent.Parent

function Purchase()
Game:GetService("MarketplaceService­"):PromptPurchase(player, itemID)
end

script.Parent.MouseButton1Down:connect(P­urchase)

The second line is the first thing. Why do we need multiple parents? I'm just so confused on this script altogether and I would like it if someone went trough it step by step.

1 answer

Parent is indicating up one inside of where something is at. For example: script.Parent would be everything in the area with the script.

You actually don't need that. You can just prompt the purchase to the LocalPlayer.

local player = game.Players.LocalPlayer

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