Sprint Script

So i’m working on a sprint script for my First Person Controller. The default one that comes with unity. What i have so far is this: `function Update () {
if(Input.GetKeyDown(KeyCode.F)) {

GetComponent(CharacterMotor.maxForwardSpeed(123));

}
}`

I get the following error: maxForwardSpeed is not a member of character motor. I am VERY new to coding so please have mercy on my noobyness. =)

Unity thinks CharacterMoter is an component, and there is no variable maxForwardSpeed, what you could do is rename the Script. And if you want to acces the script make the maxForwardSpeed variable static by saying static var instead of just var, in the other script call the script name like this:

ExampleScript.maxForwardSpeed = 123;

Click here for character controller fps script

If you want to make your own move script, check this out for a better understanding of character controllers WITHOUT the characterMotor script.

as for your problem, I think that you need to do the following:

function Update()  {

var motorScript = transform.GetComponent(CharacterMotor);

if(Input.GetKeyDown("f")) // key should be a string, not sure what you did
 {
   motorScript.maxForwardSpeed = 123;
 }

}