I need to rest my passcode because some of my buttons can’t work can I do it from another iPhone
No.
If a button or switch isn't working on your iPhone or iPad - https://support.apple.com/HT210221
You need to repair the broken iPhone.
The article I posted a link for leads you directly to repair options.