I want to download Xcode that I deleted again. But when I open App Store and search for Xcode the download button is grey When I downloaded it before I did it through App Store but now that doesn't work because of that the button is grey. Have tried to download Xcode through developer.apple but there it says that I don't have enough storage which I clearly do because I got 16 GB free. HELP
16 GB might be enough to download Xcode, but it might not be enough to install Xcode.

Xcode is delivered as compressed .dmg or .pkg file (I can't remember quite which) and it would be uncompressed upon installation.

16 GB is not a lot of space to run macOS in general.

If you need more space, you might use an app such as OmniDiskSweeper to see if there's anything taking up unexpected space.