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

Someone explain please? [MarketplaceService]

Asked by
Carvyy 15
10 years ago

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

Log in to vote
0
Answered by
TofuBytes 500 Moderation Voter
10 years ago

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
Ad

Answer this question