Help

The problem is that there are 6 errors which 4 of them say I need this " ; " and 2 say " New line in constant " please someone fix this. Here is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerSprint : MonoBehaviour
{

    float ifSprinting = Input.GetAxis("Sprint")

    // Start is called before the first frame update
    void Start()
    {
  
    }

    // Update is called once per frame
    void Update()
    {
        if (ifSprinting = 0)
        {
            PlayerMovement.OrdinarySpeed()';
        }
        else
        {
            PlayerMovement.AddSpeed()';
        }

    }
}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerSprint : MonoBehaviour
{

float ifSprinting = Input.GetAxis(“Sprint”);

// Start is called before the first frame update
public void Start()
{

}

// Update is called once per frame
private void Update()
{
if (ifSprinting = 0)
{
PlayerMovement.OrdinarySpeed();
}
else
{
PlayerMovement.AddSpeed();
}

}
}

thats the best i can do since you need to have some method for “AddSpeed” “OrdinarySpeed” unless you are calling it from another script in which case the fix is probably there

you should go follow some tutorial, there are tons of not only wrong syntax but also flawed and incomplete logic in this script, it would be better if you start learning by following a tutorial

2 Likes

Will look at some tutorial.

Code like this isn’t valid outside of a method, and even if it were it’s missing the semi-colon at the end.