Problem is, now my shop has both a small label with all the info, and a bigger one with…
- User
Problem is, now my shop has both a small label with all the info, and a bigger one with just the name of the upgrade, and when I click it another line appears with its effect.
- Assistant
What you’re seeing is exactly what happens when:
- the original
TextButton.Textis still visible (big label), and - every time you refresh or click, you create another
TextLabelinside the button (small, stacked labels).
Below is a quick, “drop-in” fix that:
• empties the original button text (so only the inner label is shown)
• creates the inner label / icon once per button (never duplicated)
• updates that same label duringrefreshButtonLabels()Copy-paste the relevant bits or replace what you have.
1 ️⃣ Adjust the template once
Open your template (
ShopFrame > UpgradeTemplate) in Studio:UpgradeTemplate (Frame or TextButton, either is fine) └── UIStroke (optional) └── UICorner (optional) └── Icon (ImageLabel) <-- create once └── InfoLabel (TextLabel) <-- create onceIf
UpgradeTemplateis a TextButton, set:Text = "" -- leave blank so it shows nothing TextScaled= false(You can also change it to a plain
Frameif you like—your scripts will treat it the same.)
2 ️⃣ Create icon / label only if they don’t exist
Put this right after you clone the template in your button-building loop:
---------------------------------------------------------- -- inside for upgradeName, upgradeData in pairs(UpgradeDefinitions) do ---------------------------------------------------------- local button = UpgradeTemplate:Clone() button.Name = upgradeName .. "Button" button.Visible = true button.Parent = ShopFrame button:SetAttribute("UpgradeName", upgradeName) -- 1. make sure the base Text is empty if button:IsA("TextButton") then button.Text = "" -- prevents the duplicate “big name” text end -- 2. add icon ONCE if not button:FindFirstChild("Icon") then local icon = Instance.new("ImageLabel") icon.Name = "Icon" icon.Size = UDim2.new(0, 32, 0, 32) icon.Position = UDim2.new(0, 8, 0.5, -16) icon.AnchorPoint = Vector2.new(0, 0.5) icon.BackgroundTransparency = 1 icon.Image = "rbxassetid://7288088538" -- replace with your icon icon.ImageColor3 = Color3.fromRGB(150,200,255) icon.Parent = button end -- 3. add info label ONCE local infoLabel = button:FindFirstChild("InfoLabel") if not infoLabel then infoLabel = Instance.new("TextLabel") infoLabel.Name = "InfoLabel" infoLabel.Size = UDim2.new(1, -48, 1, 0) infoLabel.Position = UDim2.new(0, 44, 0, 0) infoLabel.BackgroundTransparency = 1 infoLabel.TextColor3 = Color3.fromRGB(200,220,255) infoLabel.Font = Enum.Font.GothamBold infoLabel.TextSize = 14 infoLabel.TextWrapped = true infoLabel.TextXAlignment = Enum.TextXAlignment.Left infoLabel.Parent = button end ---------------------------------------------------------- -- (rest of your click connection etc.) ----------------------------------------------------------
3 ️⃣ Update text inside
refreshButtonLabels()Replace the line that used to write to
button.Textwith:local function refreshButtonLabels() for upgradeName, button in pairs(upgradeButtons) do local info = GetUpgradeInfo:InvokeServer(upgradeName) if info then local lbl = button:FindFirstChild("InfoLabel") if lbl then lbl.Text = string.format( "%s\n%s\nCost: %s\nOwned: %s", info.displayName, info.description, info.cost, info.owned ) end end end endBecause we’re re-using the same
InfoLabel, no extra lines will appear.
4 ️⃣ (Optional) remove any duplicate labels that already spawned
If you’ve run the game and buttons already have multiple
InfoLabelchildren, you can clean them in Studio by:- Stopping play,
- Deleting all extra
TextLabelchildren under each button (leave one), or - Run this small command once in the command bar:
for _,b in ipairs(game:GetDescendants()) do if b:IsA("Frame") and b.Name:sub(-6)=="Button" then local labels = b:GetChildren() local first = true for _,c in ipairs(labels) do if c:IsA("TextLabel") and c.Name=="InfoLabel" then if first then first=false else c:Destroy() end end end end end
✅ Result
• Only one, nicely-formatted info block per button
• No giant duplicate text from the base button
• No extra lines spawning on every click / refreshYour hover tweens, feedback sounds, and existing purchase logic remain untouched. Enjoy the cleaner high-tech look! 🛠️✨
- the original
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.