How to place a sign with text using commands?

I am trying to make a shop with items that get increasingly more expensive,

My problem is: How do I show the new price? This will be on a sign that I place, not in chat. Does anyone know how to place a sign with text using commands?


Solution 1:

It’s pretty simple:

/setblock ~ ~ ~ oak_sign{Text1:'{"text":"Your Text Here"}'}

This creates a sign with "Your Text Here" on line 1. For other lines of the sign replace Text1 with Text2, Text3, or Text4. I recommend McStacker for even greater customization like colors or styles. It also supports other commands like /summon or /give.