Before updating to Windows 10 you may need to return your Pro license. More information here

points system with coins

hey guys what is a good script for passing through a coin getting a point, then coin is destroyed, and after so many points getting to a next level/beating the game please help this is one of my final touches but of corse a big part

more ▼

asked Apr 21, 2011 at 02:00 AM

avatar image

jacques 1
39 36 31 37

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

Script for the Coin

   function OnTriggerEnter(hit : Collider){
    if(hit.gameObject.tag == "Player"){
    //add a tag to the player called Player, or just
    //replace it with your tag if you already have one
    ScoreSystem.myScore += 1;

Attatch this Script anywhere but name the Script "ScoreSystem" (this is very important)

static var myScore = 0; var DelayTime = 10; function Start(){ myScore = 0; Invoke("myFunction", DelayTime); }

function OnGUI(){
GUI.Label(Rect((Screen.width / 2) + 20,10, 200, 30), "Score: " + myScore); }

Attatch This Script Anywhere as well

function Update(){
if(ScoreSystem.myScore == 10){ //change the 10 to however many coins there will be
    Application.LoadLevel("YouWon");//Make a scene named "YouWon" and add it to the build

I hope this helps. Please review this code and learn from it.

more ▼

answered Apr 21, 2011 at 03:45 AM

avatar image

Alex 9
89 58 38 42

what do i do? it says trying to Invoke method: ScoreSystem.myFunction couln't be called

Apr 21, 2011 at 09:27 PM jacques 1

Alex 9, can you tell that how the score of previous level would be added to next level starting score, Because it seams from your script that it would start with "zero" every-time!

Dec 08, 2012 at 09:31 AM himanshu619
(comments are locked)
10|3000 characters needed characters left

Using playerprefs could solve the problem of coins reloading.

PlayerPrefs.setint("score",myscore); //this will set the coin value

PlayerPrefs.Getint("score"); // this will get the stored coin value

more ▼

answered Jun 30 at 04:34 AM

avatar image


(comments are locked)
10|3000 characters needed characters left

Soomla has pretty good Scoring system with lots of features icluding social sharing,achievements ,IAP and lot more for FREE, have look at it, http://soom.la/

more ▼

answered Jun 30 at 05:07 AM

avatar image

41 2 5 9

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Apr 21, 2011 at 02:00 AM

Seen: 4512 times

Last Updated: Jun 30 at 05:07 AM