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

Is there an alternative to using LocalPlayer in a localscript?

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

2 comments

0

Doesn't make any sense, why are you trying to get the player in a local script without game.Players.LocalPlayer?

0

You have to explain more what you are thinking? A touched/hit function? Do you mean connecting to the Touched event for BaseParts?

1 answer

✓ Accepted answer

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

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