Why iPhone and iPad sometimes can't connect to WiFi?

pic
Something strange has happened.
Yesterday, when I tried to connect to my room’s wifi, it showed that I couldn’t connect, even though I typed in the correct password. I even tried using my iPad, but I faced the same issue. However, my friend’s phone could connect normally. Why would this happen?

Try connecting to your Wi-Fi in a different location. If it still cannot work, you may need to check your iPhone or iPad as well as the router.
You can reset the network settings for your iPhone or iPad. Sometimes you may also need to update your router.

You can try the following.
Make sure the router has not set restrictions for iPad and iPhone.
Router issues: The WiFi router or access point may be experiencing issues that prevent a successful connection. Restarting or resetting the router to factory settings can sometimes resolve the problem.
Reconnect to WIFI: You can try to forget and reconnect to the WiFi network.

Have you tried to restart your iOS or iPadOS device? Try to tap Settings > General > Transfer or Reset [Device] > Reset > Reset Network Settings. It will reset Wi-Fi networks and passwords, cellular settings, and VPN and APN settings that you’ve used before.

The router hasn’t been touched at all, and it used to connect perfectly before. I did try the method you suggested, but it still doesn’t work.

I’ll give it a shot tonight