Answers.Body: <p>The error message is telling you that you've got a stray bracket, so count your brackets and see if the <code>(</code>s match the <code>)</code>s. Spoiler alert: they don't.</p>
  
  <p>I can see two cases: after each <code>linear</code> function call you have a closing bracket after the <code>"Null 1"</code> string that isn't matched by an opening bracket. And <code>"Null 1"</code> on its own is just treated as a string, not a layer, so that's another problem.</p>
  
  <p>I'm assuming you mean <code>thisComp.layer("Null 1")</code> which is a reference to a layer. So</p>
  
  <pre><code>out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
  </code></pre>
  
  <p>should be </p>
  
  <pre><code>out = linear(thisComp.layer("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-03T08:00:25.040Z
Answers.Text: I got it working, thank you!
Answers.UserDisplayName: torako
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-04T05:26:37.047Z
Answers.Text: Don't thank me, mash that tick button!
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-03T03:57:44.703Z
Answers.LastActivityDate: 2020-02-03T03:57:44.703Z
Answers.UserDisplayName: stib
Body: <p>I'm trying to make a slider that basically can act as a crossfader between a bunch of different layers (so as the slider goes up, it fades through several layers). This is what I've written, and I'm getting the error "Error: SyntaxError: Unexpected Token )" on the first line and I'm having trouble telling where the problem is.
  My code:</p>
  
  <pre><code>if(thisComp.layer("Null 1").effect("Slider Control")("Slider") &lt;= 5)
  {
      if(thisComp.layer("Null 1").effect("Slider Control")("Slider") &lt;= 2.5)
      {
          out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
      }
      else
      {
          out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 2.5, 5);
          out = 100 - out;
      }
      }
  }
  else{
      out = 0;
  }
  out;
  </code></pre>
  
  <p>Thank you!!</p>
  
Tags: <after-effects-expressions>
Title: after effects slider control code help
UserDisplayName: torako
ThreadText: # after effects slider control code help
  
  (Asked by: username_0 on 2020-02-01)
  
  I'm trying to make a slider that basically can act as a crossfader between a bunch of different layers (so as the slider goes up, it fades through several layers). This is what I've written, and I'm getting the error "Error: SyntaxError: Unexpected Token )" on the first line and I'm having trouble telling where the problem is.
  My code:
  
  ```
  if(thisComp.layer("Null 1").effect("Slider Control")("Slider") <= 5)
  {
      if(thisComp.layer("Null 1").effect("Slider Control")("Slider") <= 2.5)
      {
          out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
      }
      else
      {
          out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 2.5, 5);
          out = 100 - out;
      }
      }
  }
  else{
      out = 0;
  }
  out;
  
  ```
  
  Thank you!!
  
  **Tags:** after-effects-expressions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-02-03. Score: 1
  
  The error message is telling you that you've got a stray bracket, so count your brackets and see if the `(`s match the `)`s. Spoiler alert: they don't.
  
  I can see two cases: after each `linear` function call you have a closing bracket after the `"Null 1"` string that isn't matched by an opening bracket. And `"Null 1"` on its own is just treated as a string, not a layer, so that's another problem.
  
  I'm assuming you mean `thisComp.layer("Null 1")` which is a reference to a layer. So
  
  ```
  out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
  
  ```
  
  should be
  
  ```
  out = linear(thisComp.layer("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
  
  ```
  
  > **Comments:**
  > **username_0**: I got it working, thank you!  
  > **username_1**: Don't thank me, mash that tick button!  
  
  ---
  
  