I have this script that contains my score, this script was downloaded from a tutorial and comes with the action of pressing the b key and it adds the player 100 points, i want to change that so that when the player collides with the tag Coin it adds up 100 points and then it destroys the abject with the tag Coin. This is the code:
var score1 : GUIText;
var myScore : int = 0;
var myCurScore : int = 500;
function Update () {
score1.text = "Score: " + myScore;
if(myScore < myCurScore) {
myScore += 10;
}
if(Input.GetKeyDown("b")) {
myCurScore += 100;
}
},
Thanks, but i have tried with on trigger enter
– juaaanDid you add the rigidbody to the object as I said before?
– Vereosyes, but its still not working, i put to the player object and to the Coin object
– juaaan