Left hand side must be variable, propert, or idexer.

I am semi new, I have most of the basics down but no matter what I do to this section of code it always gives me errors. Most of my modifications to it made way too many errors in the console but with this I have it down to 2. They are both the one it the title, and here is the code, in c#.

void TurnTo(int pos){
		if ((Walk_To_Waypoint) = true )
		Rigidbody = (RigidbodyConstraints.FreezeRotationY);
	}

For the start, in this case try to write “Rigidbody” as “rigidbody”. This will remove “Left hand side must be variable, propert, or idexer” error you got…

Hmm there is more wrong here than that.

void TurnTo(int pos){

        if ((Walk_To_Waypoint) = true )

        Rigidbody = (RigidbodyConstraints.FreezeRotationY);

    }

Rigidbody = (RigidbodyConstraints.FreezeRotationY is wrong.

also

if ((Walk_To_Waypoint) = true ) is wrong.

void TurnTo(int pos){

        if (Walk_To_Waypoint){
              rigidbody.constraints = RigidbodyConstraints.FreezeRotationY;
        }
}

Yes, you’re right :slight_smile: I was planning to explain him step by step, but you already did the good job :smile:

Thank you everyone, now I get a cannot covert method group ‘Walk_To_Waypoint’ to non delegate type ‘bool’. consider using parenthesis to invoke this method. :face_with_spiral_eyes:

We need to see the rest of your code then. Because for some reason you are making some basic coding errors.

I got it, Walk_To_Waypoint was a bool, and couldn’t be used like that, deleting the if statement entirely got it going.

explain why the bool would not work like that?

bools are supposed to be used in situations like that… so I’m as confused as you EliteMossy :wink:

Walk to waypoint was not something that was true or false, thats just what my friend told me once he got here. He said it was not something you could check to be true or false. It was just a part of the code, not a variable or anything.
It was not a bool but that was how I was trying to use it, I guess. I am not very good at this yet, so sorry if I confused anyone.