Help With Score C# Error CS0131
IDK what to do
enemy.onDestroyed = () => {
score += 100;
infoText.text = "Score: " = score.ToString();
};
the error is on line 3 the "infoText.text = "Score: " =.ToString();
its says "The left-hand side of an assignment must be a variable, property or indexer" idk what they mean
Answer by Darksorcerer57 · Aug 03, 2017 at 10:33 PM
What's this code trying to do? You can not set an explicit, non-variable string as another string (it's like you're saying that 0 has the same value of 1). And you're trying to set a variable to that illogical expression. You can't have two "=" on the same line unless comparing.
EDIT: I just actually read it and you need to change the "=" on the right to a "+"
Your answer
![](https://koobas.hobune.stream/wayback/20220612131853im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I add extra points for coming close to obstacle but NOT for coming close and colliding? 1 Answer
Scoring system not working. 1 Answer
Spawn Object on Set Score 0 Answers
Coin Pickup system carry int into void 1 Answer
Score counted multiple times when several projectiles impact the same target 1 Answer