If you are referring to Lock screen passcode then they aren't related. Passcodes are device dependent and are not linked to another device.
Forgot (You need a computer to follow these steps. If you don't have a computer, borrow one from a friend,)
I am sorry, if you have forgotten your Lock Screen passcode and there is no backup, then all data is lost, if you have one, not to worry. But if you have forgotten the Screen Time Passcode and even if you have a backup everything is lost because restoring will bring back the screen time restrictions (Status Quo).
What you will get back is what you have synced to iCloud and uploaded to iCloud Drive; information already synced and stored in iCloud, like Contacts, Calendars, Bookmarks, Mail, Notes, Voice Memos, shared photos, iCloud Photos *, Health data, call history, and files you store in iCloud Drive.
*-If you had turned on iCloud Photos, your content is automatically stored in iCloud.
Forgot either? Click below…
Click->If you forgot the passcode for your iPhone, iPad, or iPod touch, or your ...