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

Is there an alternative to using LocalPlayer in a localscript?

Asked by
Galicate 106
7 years ago

Is there an alternative to using localplayer without using touched/hit function?

0
Doesn't make any sense, why are you trying to get the player in a local script without game.Players.LocalPlayer? Eqicness 255 — 7y
0
You have to explain more what you are thinking? A touched/hit function? Do you mean connecting to the Touched event for BaseParts? User#18718 0 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Well if the script is a child direct child of the player then just use

local player = script.parent

but if it is let's say in a tool that is a direct child of the player then use

local player = script.parent.parent

And so on and so on, that makes it where you can just use the keyword "player" to refer to the player that the script is running for. Hope that helped

Ad

Answer this question