"Year-old" is used as a part of a noun phrase, e.g. "That man is a 30 year-old", whereas "years old" (with no hyphen) is used as part of an adjective, e.g. "That man is 30 years old".
P.S. Do remember to capitalise the start of sentences.
[Not a teacher]