HTML Onclick not triggering Javascript function

Hello there. I’m new to HTML and Javascript making a web app where it keeps track of a score variable in a seperate javascript file and every day the user fills out a form and submits their answers. I was trying to make it so that when an option is clicked it would call an addPoints function and update the score to display on another html file. I’ve tested the javascript functions and they seem to be working just fine. It’s mainly the onclick thats not responding for some reason. Heres an example of one of the questions in the form

<p>Did you use eco-friendly materials?</p>
    <form>
      <input type="radio" name="yesorno" id="yes2">
      <label for="Yes" onclick="addPoints()">Yes</label>
      <input type="radio" name="yesorno" id="no2">
      <label for="No">No</label>
      <script src="script.js"></script> <!-- the external js file -->
    </form>

I’ve tried testing it a ton of times and checking whether the score on the other html file updated or not but it never seems to update. Its updated when I update the variable in the JS file just not when calling the function with onclick

I’ve put the source for the javascript file in the head too though it dosen’t seem to be working. The JS function just updates a variable in the JS file so idk why its not working. Help would be appreciated

Your onclick method is attached to the label, not the radio button. Does it work when you click on the label?

I tried this however it still didn’t do anything

<p>Did you use eco-friendly materials?</p>
    <form>
      <input type="radio" name="yesorno" id="yes2" onclick="addPoints()">
      <label for="Yes">Yes</label>
      <input type="radio" name="yesorno" id="no2">
      <label for="No">No</label>
      <script src="script.js"></script>
    </form>

I might do the questions like this instead

<p>
        TESTING
    </p>
      
    If you went fishing, did you follow “catch and release” practices?
    <input type="radio" name="Yes" value="1">1
    <input type="radio" name="No" value="0">0
    <input type="radio" name="Test" value="2">2
      
    <br>

and then find the point values like this

<script>
        function displayRadioValue() {
            document.getElementById("result").innerHTML = "";
            var ele = document.getElementsByTagName('input');
              
            for(i = 0; i < ele.length; i++) {
                  
                if(ele[i].type="radio") {
                  
                    if(ele[i].checked)
                        document.getElementById("result").innerHTML
                                += ele[i].name + " Value: "
                                + ele[i].value + "<br>";
                    if (ele[i].value === "1"){
                      addPoints();
                    }
                }
            }
        }

However theres still the issue of calling the addPoints method from the HTML file which dosent seem to be working. I manage to get it working on my other file where I called getScore, a JS function which returned the score, but addScore dosen’t seem to be working