title: Pets is not a valid member of Player
body: <p>I'm getting the error:</p>
  <blockquote>
  <p>Pets is not a valid member of Player &quot;Players.levstar86&quot;</p>
  </blockquote>
  <p>Help would be greatly appreciated</p>
  <pre><code>    game.Players.PlayerAdded:Connect(function(player)
      local leaderstats = Instance.new('Folder', player)
      leaderstats.Name = 'leaderstats'
  
      local pets = Instance.new('Folder', player)
      pets.Name = 'Pet'
  
      local coins = Instance.new('IntValue', leaderstats)
      coins.Name = 'Coins'
      coins.Value = 5000
  
      player.CharacterAdded:Connect(function(char)
          local attachment = Instance.new('Attachment', char.HumanoidRootPart)
          attachment.Name = 'CharacterAt'
      end)
  end)
  
  
  game.ReplicatedStorage.Remotes.Add.OnServerEvent:Connect(function(player, amount)
      local currency = 'Coins'
      player.leaderstats[currency].Value = player.leaderstats[currency].Value + amount
  end)
  
  game.ReplicatedStorage.RemoteFunctions.EquipPet.OnServerInvoke = function(player, pet)
      local currency = 'Coins'
      local MainPet = game.ServerStorage.Pets:FindFirstChild(pet)
  
      if not player.Pets:FindFirstChild(MainPet.Name) then
          if player.leaderstats[currency].Value &gt;= MainPet.Price.Value then
              player.leaderstats[currency].Value = player.leaderstats[currency].Value - MainPet.Price.Value
              local clonedPet = MainPet:Clone()
              clonedPet.Parent = player.Character
              clonedPet:SetPrimaryPartCFrame(player.Character.Head.CFrame)
  
              local atPet = Instance.new('Attachment', clonedPet.PrimaryPart)
  
              local ap = Instance.new('AlignPosition')
              ap.Parent = clonedPet
              ap.RigidityEnabled = true
              ap.Attachment0 = atPet
              ap.Attachment1 = player.Character.HumanoidRootPart.CharacterAt
  
  
              return 'Bought' 
          else 
              return 'Not enough coins'
          end
      else
          return 'Equip'
      end
  end
  </code></pre>