Need help! Can`t understand!

Hello everybody! I have a big problem.
So, my main task is to change speed of my char if score equals to 100.
So i have few scripts for it.

First of all im sending scores to my movement script

void OnDisable()
    {
        PlayerPrefs.SetInt ("Score", (int)playerScore);
    }

Then im taking scores in my movement script and creating if statement, that if scores equals to 100 speed will become +1 from original speed ( its equals to 3.0f)

void increasespeed()
    {
        score = PlayerPrefs.GetInt ("Score") * 10;
        if((int)score == 100)
        {
            speed = speed + 1.0f;
        }
    }

But char speed is staying 3.0 without any change
Where`s my mistake?

Maybe you score variable never get the 100 value, and the if never starts.
You can try adding a line like:

Debug.Log(score, gameobject);

in the function increaseSpeed() and execute the game, checking the console, it will say you the value of score. Or using breakpoints for debugging.

I dont know how does it works, im just added this line in my code, but nothing happens. Doesnt matter, ive checked my “Score-system” it works totally correctly.
Also, system which send score-info is working too. I don`t have any ideas.

Basic question: do you call that function in Update?

Uhm… Maybe im so newbie at this, but i cant understand: is it necessarily?
No, i don`t. How can i do it?

Okay, i`ve added if statement in Update.
If i keep *10 (score) nothing happens, but if i will change it to 100 my char going to fly away.

Can you post the full script?

I have few scripts in my game. Maybe i can upload full project for you? Or you need just these scripts ( score and movement ) ?

i need the class where is the code posted in the open post.

I`m using two.

cmove

using UnityEngine;
using System.Collections;

public class cmove : MonoBehaviour {
   
    public float speed = 6.0f; // Player`s speed
    Transform groundcheck;
    private float overlapRadius = 0.2f;
    public LayerMask whatIsGround;
    private bool grounded = false;
    private bool jump = false;
    public float jumpforce = 60f;
    private bool doublejump = false;
    float score = 0;
   

    void Start()
    {
        score = PlayerPrefs.GetInt ("Score") * 10;
        groundcheck = transform.Find ("groundcheck");
    }
   
    void Update()
    { 
        if(score>=120)
        {
            speed = speed + 1f;
        }


        if (Input.GetKeyDown(KeyCode.Space))
            jump = true;
    }
   
    void FixedUpdate()
    {
       
        // Check char grounded
       
        grounded = Physics2D.OverlapCircle(groundcheck.position, overlapRadius, whatIsGround);
        // Reseting doublejump when on the ground  
       
        if (grounded)
            doublejump = false;
       
        // Determine if player can jump
        bool canJump = (grounded || !doublejump);
       
        //
       
        if (jump && canJump) 
        {
            rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, 0);
            rigidbody2D.AddForce(new Vector2(0, jumpforce));
           
           
            if (!grounded)
                doublejump = true;
        }
       
        jump = false;
       
        rigidbody2D.velocity = new Vector2(speed, rigidbody2D.velocity.y); // const speed
    }
}

scorescript

using UnityEngine;
using System.Collections;

public class ScoreScript : MonoBehaviour {

    float playerScore = 0;

    void Update () {
        playerScore += Time.deltaTime;

    }
    public void IncreaseScore(int amount)
    {
        playerScore += amount;
    }

    void OnDisable()
    {
        PlayerPrefs.SetInt ("Score", (int)playerScore);
    }

    void OnGUI()
    {
        GUI.Label (new Rect (10, 10, 100, 30), "Score: " + (int)(playerScore * 10));
    }



}

Never used an OOP language?
The Function IncreaseScore isn’t called on the attached script, so the code will never runned. There is a class that calls that function? If not, thats why the code not works, if yes, post that class.

uhm… I think i have some big troubles in my knowledge.
What should i do?
Should i create public, void or something another?

no, you not have to create anything, simply call the function. A void is a type of function. Just look this video, it explains variables and functions.

I cant understand what i should change. I have some void ( which is function ), i have added something to Update void. I cant understand anyway.

To call a function you should write in a called function FunctionName(parameters);
For example:

void Update()
{
  //calling the FunctionA function
  FunctionA();
}

if you still not understand i suggest to follow all the scripting tutorials in the learn section of unity3d.com

Oh yeah, my fail. Sure, i can understand you now.
I changed my code a bit, but it still doesnt work.

Now i have something like that:

public float baseSpeed = 3.0f; 
    public float speed = 0;
    int score = 0;

    void IncreaseSpeed()
    {
        speed = baseSpeed + (int)score/100;
    }

    void Start()
    {
        groundcheck = transform.Find ("groundcheck");
    }
 
    void Update()
    {
        IncreaseSpeed();
        score = PlayerPrefs.GetInt ("Score") * 10;
        if (Input.GetKeyDown(KeyCode.Space))
            jump = true;

    }

Maybe move this line score = PlayerPrefs.GetInt ("Score") * 10; from the Start function to the Update function

Yes, i moved it to Update

True, didn’t see that… What is the GUILabel of the score showing…

First label is for GAME OVER title, second is for the total score, and the last button is for RETRY fuction.