Trigger reference problem

114683-screenshot-5.png
My bus goes to trigger and I get null reference exception problem on this script.

I want a move passenger in trigger enter.

So how I do this ?

*

Good day.

I was writing your answer in the last post, but you changed it and now have to write all again… :frowning:

null reference exception means there is a variable that is not assigned when trying to execute that line. So if the problem is in the image line, most probably the boject containing this script, does not have the component passangermove so when try to find it gives you the error.
You see you are not looking for the PAssangerMove in the bus right? you are looking inside the same GameObject that contains this script. To acces the bus you need:

other.GetComponent<PassangerMove>().....

A good practice is to use

Debug.Log(SomeVariable);

just the line before of the problematic line to see whats the state of the variable.

Other important thing. Is NOT a good practice to enable/disable scripts. Is beter to have the script always enabled, and change some variable when needed (like a bool) to allow the script do something.

If helped, accept the answer!
If need more help, give more info!