Minecraft – Why doesn’t this /give command work

minecraft-commandsminecraft-java-edition

So basically I have this command,

give @p sign 1 0
{
    BlockEntityTag:{
        Text2:"{\"text\":\"Don't Click me\",\"strikethrough\":true}",
        Text3:"{
            \"text\":\"Click Me!\",
            \"italic\":true,
            \"underlined\":true,
            \"clickEvent\":{
                \"action\":\"run_command\",
                \"value\":\"/setblock ~ ~100 ~ repeating_command_block{
                    Command:\\"/gamemode creative @a\\",
                    auto:1}
                \"
            }
        }"
    },
    display:{
        Name:"Custom Sign"
    }
}

Which in theory, when activated it should spawn a sign which when placed and right-clicked should spawn a repeating command block 100 blocks in the air which sets everyone in the server (@a) to creative mode. Although when I try to use it, only the "/give @p) part isn't red. I don't know much about commands but I can't seem to find anything wrong with it. Any help would be appreciated. Also I'm in version 1.16.4.

Best Answer

There are 3 things wrong with this command:

Firstly, the sign item name has been renamed to oak_sign (for definite future-proofness, I'd recommend you use minecraft:oak_sign instead).

Secondly, positioning for the NBT tag of an item is right after the item name itself. For example:

/give @p minecraft:oak_sign{display:{Name:"{\"text\":\"My Custom Name\"}"}} 1

Thirdly, I tried running your exact command and the syntax for the NBT data didn't seem to be correct. I can't figure out why, but if anyone can they should feel free to edit this answer