wont stay on

I got a dryer from a friend that she had in her house working but when we brought it to my house it doesn’t want to. When I turn on the dryer it will stay on for a few seconds then off an I have to wait for a clicking then I can turn on agan but it does the same thing, without tripping the breaker. I have taken the top and front panel off to clean the lint out with a vac. I layed it down to clean everywhere. please help I have looked at the wires they look ok.