title: attempt to index field 'LocalPlayer' (a nil value)
body: <p>i have been trying to fix this problem in my game:
  "attempt to index field 'LocalPlayer' (a nil value)"</p>
  
  <p>but nothing i tried to do worked
  here is the code:</p>
  
  <p>please do not mind the extremely un-efficient lines of code</p>
  
  <pre><code>local player = game.Players.LocalPlayer
  
  script.Parent.Humanoid.Died:Connect(function()
      print("yeet")
      script.Parent.Parent.Parent.Players.LocalPlayer.leaderstats.PuzzlePieces.Value = script.Parent.Parent.Parent.Players.LocalPlayer.leaderstats.PuzzlePieces.Value + 1
  end)
  </code></pre>
  
  <p>and this is the error message i get:</p>
  
  <pre><code>attempt to index field 'LocalPlayer' (a nil value)
  </code></pre>