local plr = game.Players.Localplayer
lets say i put a serverscript in the workspace and want to get Localplayer. But the problem is that it doesnt work. I saw articles about this but i dont understand how to solve it. Please help.
Edit : I want to use it like a variable so i can get the players backpack
Edit : To get a player just add another function
game.Players.PlayerAdded:Connect(function(player)
and remember to add another end) if you have two functions!

3 comments
You cant get local player, but you can use game.Players.PlayerAdded event to get the player
You can't get the LocalPlayer by a variable, you can get it by doing: game.Players.PlayerAdded:Connect(function(player), but you can get it with a variable doing this: local player = script.Parent.Parent.Parent only if it's something in your backpack like a Tool for example because Tool's parent changes everytime the Parent is changed.
a server holds all clients, which means even if there was a variable to get the player, it would get every player or a server instanced as a player which wouldnt make sense, you can however stole player names in a table and create a variable for each player to index them...