[SOLVED] Score Help in Script

Hi, I need help. I am trying to trigger the scoring for number of #enemies killed but it shows an error.
I used this script to trigger the score count by the # of “enemies being killed” can someone help please.

these are the pictures


this is the script where I triggered the score, help.

Hi @ETHAN_FOX_CRISTOBAL! As far I can see, the error has to do with line 15 of your FireInsecticide.js script. Are you sure the asset ID is correct?

yes, Albertos. It’s correct

there is also an error in FindByName

I am still doing the score triggering but this came in my script an error in FindByName. I need help.

Please do not create multiple posts about the same issue.

Hello, why does my score not work.
When I destroy the “enemy” in my game, it shows an error.
Idk how to fix it

These pictures are the entity: “enemy”, scoreboard: “score”, and the script which shows the error.

these are the pictures

the error says: “counter is not defined”

I need help please

this is the link to my game

I used the counter +=1


The error says “counter is not defined”. Where do you define the counter variable?

1 Like

Christina, actually. There is, I put the wrong version it is actually counter += 0;

I should actually put it up. But the error is also within FindByName it is also an error.

Albertos, I need help. What’s the correct script. My teacher said that it is var = 0;

After the first line of the script:

var counter = 0;

Albertos, is this the correct format. What script do you recommend or where should I fix it? My teacher said it should be in order to declare it first here is where I put the var = 0;

Also there is an error in FindByName, what code should I use then? What do I put on it as well?

I sent u something

There is a capital letter missing in line 26. Can you try to replace line 25 and 26 with the lines below?

counter += 1;
var score = this.app.root.findByName('Score');

Which lines?

Line 25 and 26 that I can see on the screenshot you shared.