if local script can do localplayer , what about the script ,since I heard localplayer doesnt work on a script ?
what is localplayer called on a script ?
2 answers
LocalPlayer can be accessed through a LocalScript. This is because a LocalScript is intended to be replicated for every player.
The script can access the player model through RemoteEvents, or just searching for them manually.
If this is the answer you looked for, then make this an accepted answer.
If you have any other questions respond.
Any LocalScript, allows you to Automatically Hook-Into that Client (LocalPlayer). Since the LocalScript, is directly replicated on that; specific Client.
Scripts, are a-bit different; and are usually called "ServerScripts". In this case, ServerScripts are only replicated/available on the Server. Meaning, you can't directly access a certain player, without specifying their name, userId, etc.
Examples:
--//LocalScript
local plr = game:GetService("Players").LocalPlayer -- As said, this player is LOCAL to the Script.
print(plr.Name)
--//ServerScript
repeat wait() until game:IsLoaded() -- Server Loads before Client/Players... Or, Just wait(#)
Players = game:GetService("Players")
local Name = "PlayerName" -- For actual ServerScript, having a Preset Name isn't a good idea. Best to-have Remote Function, call from Client-Server. Parsing Player Name.
local plr = Players[Name]
print(plr.Name)
Despite all this, I'd highly recommend looking at this:
https://scriptinghelpers.org/guides/server-client-relationship-in-roblox
Hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
you can use :GetPlayerFromCharacter() when you use a touch event or something else