having trouble writing a library.

I am making a library for my homemade proximity sensor. The library sets a variable to either true false or error to determine the state of the proximity sensor. But when I try it, it gives me an error saying that, that variable isn't declared in this scope

Can you post the code so maybe we can find the answer?

garrettd1234: when I try it, it gives me an error saying that, that variable isn't declared in this scope

That sounds like a compiler error, which is telling you that your code is trying to use a variable which hasn't been declared or hasn't been declared correctly. In other words, there's something wrong with your code.