Disable a script on collision

Hi, I’m trying to disable the ThirdPersonController script on my player on Collision so that he attaches himself onto a sphere and then the NormalWalking Script takes over so he floats around it like a moon’s gravity. I’d like to be able to disable the ThirdPersonController on collision with the moon and enable the script when he collides with something else but I think I’ve done something wrong. Can anybody help me out?

function OnCollisionEnter (other : Collision)

if (other.name == “world”)
print(“off”); }

if (other.name != “world”)

print(“on”); }


Well, first you should always say what you are trying to do(as you are) but also mention what happens instead of the intended result. Like what error do you get and so on.

In this case I am going to guess you are getting an error because you are using GameObject instead of gameObject.

Sorry for being vague but I’m not getting any errors at all. The script just won’t disable and my character falls to his death when the two collide and I walk off the edge.