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

What should I use to locate the players backpack that clicked buy

Asked by 10 years ago

This line doesnt work

player = script.Parent.Parent.Parent.Parent.Parent

is there a better way to locate the player who click on a button's backpack?

Plz herlp

1
Using a LocalScript you can get player using the LocalPlayer property of the Players service (player = game.Players.LocalPlayer) if you're going to get the player through parents (hierarchy) then do something like this: gui = script.Parent.Parent; player = gui.Parent  nate890 495 — 10y
1
ok.. i think i understand now Thanks tho SirKitten2000 0 — 10y

1 answer

Log in to vote
0
Answered by
trogyssy 221 Moderation Voter
10 years ago

If it's a LocalScript

player=Game.Players.LocalPlayer

Otherwise, just make sure you've counted the parents properly. The player would be equivalent to StarterGui plus one .Parent.

1
thanks SirKitten2000 0 — 10y
Ad

Answer this question