Controlling objects

Hi everybody … i am a roocki in this… this is my question… i am developing a game where the user is walking and them can get into cars or buses … what i want is that when the user click a button it change the control from a walking script i have on the player to a driving script i have on the car… do anybody have idea of how to do this??? can give me some tutorials? some scripts? anything? thanks

You simply enable and disable scripts or parts of your scripts. If the player is inside a car then you disable the script for walking. To keep things simple now in the beginning you could just add an if-statement (boolean) which you switch on vehicle entry.

if(!insideVehicle){
//all your walking script
}

Or attach and remove scripts at runtime to your objects, have a look at AddComponent.
You could also as a third option just enable/disable the whole scripts: object.GetComponent(TheScript).enabled = false;.

There’s many ways of doing this and it all depends on what works best for your project in the end. If you have many random controllable objects I would go with attaching scripts at runtime and removing them when they’re not needed.