Change the value of the motorspeed

I’m working with Wheel Joint 2D and I want to change the value of Motor Speed to 0, from a different script to the script that controls the motor.
Then as I can make the call to said motor.
personaje.getcomponent().motor.motorspeed = 0; Get error

This is a “small” problem that dealing come for days and I have not been solved
Thank you for your help

First of all, it’d be very good if you actually copied the error message you’re getting here so we have a better idea of what the problem is. It’d also be good to know what language you’re using to write your code. I’m gessing that’s Javascript?

Anyway, assuming personaje is your game object, I think what you want to do is:

personaje.GetComponent(WheelJoint2D).motor.motorspeed = 0;

or, in C#

personaje.GetComponent<WheelJoint2D>().motor.motorspeed = 0;

Specifying the type of component you want to get(and also correct capitalization; these languages are case sensitive!)

If this doesn’t work, please come back with more details we can work with. Good luck!

cannot modify return value of unityengine whilejoint2d motor because it’s not variable