After effects, make background rectangle the same size as text

If my text layer is named ‘text’, then this js will be in the background rectangle ‘Size’: // Define the text layer to follow var textLayer = thisComp.layer("text"); // Replace with your text layer name // Get the size of the text var textRect = textLayer.sourceRectAtTime(time, false); // Define padding var paddingX = 10; // Width padding var paddingY = 30; // Height padding // Calculate final…