Ryzen is made by AMD and the Z170 board is for intel chips. This will not work on every conceivable level.
Each CPU has a "socket" type, a specific number of pins (or metal contacts) in a specific configuration and thus for all of those electrical contacts/pins to connect and alllow the CPU to work it has to be matched to a motherboard with the exact same socket.
In your case for a Ryzen CPU that is a socket AM4 motherboard which would currently be the B350 and X370.
B350 is cheaper and for most is sufficient, but X370 has more slots for more add-on cards and GPUs, and typically more connection ports as well.