-3

This question already has an answer here:

I'm trying to make a command that summons a sign that you can buy a certain item from, however I keep on getting a error with inserting the lore and the custom name, the command that I have used is,

/give @p sign 1 0 {BlockEntityTag:{Text1:"[{\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @p[score_Grains=0] {\\\"text\\\":\\\"You do not have enough Grains to buy that\\\",\\\"color\\\":\\\"dark_red\\\"}\"},\"text\":\"[Buy]\",\"bold\":\"true\"}]",Text2:"[{\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @p[score_Grains_min=1] {\\\"text\\\\\\\":\\\"You just bought 1 Test for $1\\\",\\\"color\\\":\\\"dark_green\\\"}\"},\"text\":\"Test\",\"underlined\":\"true\"}]",Text3:"[{\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/give @p[score_Grains_min=1] minecraft:paper 1 0 {display:{Name:"Test",Lore:["Test"]},ench:[{id:0,lvl:10}]}\"},\"text\":\"$1\",\"color\":\"green\"}]",Text4:"[{\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/scoreboard players remove @p[score_Grains_min=1] Grains 1\"},\"text\":\"1\"}]"},display:{Name:"Buy Test"}}

However, there is a error message which is,

[13:21:48] Data tag parsing failed: Unexpected token 'T' at: Test",Lore:["Test"]},ench:[{id:0,lvl:10}]}\"},\"text\":\"$1\",\"color\":\"green\"}]",Text4:"[{\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/scoreboard players remove @p[score_Grains_min=1] Grains 1\"},\"text\":\"1\"}]"

What is wrong? And how do I fix this?

marked as duplicate by Virusbomb, galacticninja, Ivo Coumans, arghtype, Tim S. Jul 18 at 19:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    It would be more helpful to copy/paste the actual command text being used instead of an image of the text. – Skylinerw Sep 5 '16 at 4:59
  • Before ench you closed your last { }, so this goes nowhere. That's why it fails. Please count your brackets or post the command as text, so we can read it properly. There might be other syntax errors. – dly Sep 5 '16 at 7:16
  • @Skylinerw There, I added the command instead of the image. – Desterious Sep 5 '16 at 17:26
  • @dly I have tried that, however I still get the same error. – Desterious Sep 5 '16 at 22:22
  • That was just one mistake I found on the first view. There may still be more – dly Sep 6 '16 at 5:53
0

Syntax should be fine with this one:
(Using the actual functionality is up to you. I haven't tested the scoreboard values, but now you have something to start working with.)

/give @p sign 1 0 {
    BlockEntityTag: {
        Text1: "{\"text\":\"[Buy]\",\"color\":\"dark_red\",\"bold\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @p[score_Grains=0] [\\\"text\\\":\\\"You do not have enough Grains to buy that\\\",\\\"color\\\":\\\"dark_red\\\"}]\"}}",
        Text2: "{\"text\":\"Test\",\"color\":\"dark_green\",\"underlined\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @p[score_Grains_min=1] [\\\"text\\\":\\\"You just bought 1 Test for 1$\\\",\\\"color\\\":\\\"dark_green\\\"}]\"}}",
        Text3: "{\"text\":\"$1\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/give @p[score_Grains_min=1] minecraft:paper 1 0 {display:{Name:Test,Lore:[Test]},ench:[{id:0,lvl:10}]}\"}}",
        Text4: "{\"text\":\"1\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/scoreboard players remove @p[score_Grains_min=1] Grains 1\"}}"    },
    display: {
        Name: "Test Buy"    
  }
}

Sign

  • It works, I have a question, if I want to add more enchantments to that item, how do I so without messing the whole thing up? – Desterious Sep 6 '16 at 14:52
  • Can I use this concept as a sell sign as well? And how? – Desterious Sep 6 '16 at 15:26
  • @Desterious You can alter the part ench:[{id:0,lvl:10},{id:1,lvl:10},{id:2,lvl:10}] to adjust your desired enchantments. If you want somethig completely new please ask a new question. – dly Sep 6 '16 at 16:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.