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.
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