I was trying to give specified players a gravity coil when they entered the game. Here's the script:
local rs= game:GetService('ReplicatedStorage') --The Gravity Coil is in ReplicatedStorage by the way.
local plr = game.Players.LocalPlayer
game.Players.PlayerAdded:connect(function()
local admins = (
plr.UserId == 90568658 or
plr.UserId == 76204529
)
if admins then
rs.GravityCoil:Clone().Parent = plr.StarterGear
rs.GravityCoil:Clone().Parent = plr.Backpack
end
end)
However, I got this error:
21:15:19.133 - Workspace.Script:7: attempt to index upvalue 'plr' (a nil value)
Please tell me what was wrong in the script or give me a link when there is a post with a similar problem.

2 comments
You never defined plr in the event. LocalPlayer can not be accessed via ServerScript.
do i have to put that into the LocalScript then?