How to make TextLabel copy from Table

So i’m trying to make a description pop-up for each tower whenever they are hovered on. I don’t know how to do this…

local TextButton = script.Parent

local towerInfo = script.Parent.Parent.Parent.Parent.TowerInfo

local SFX = workspace.SFX

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local towers = require(ReplicatedStorage:WaitForChild("TowerShop"))

TextButton.MouseEnter:Connect(function()

SFX.hover:Play()

towerInfo.Visible = true

end)

TextButton.MouseLeave:Connect(function()

towerInfo.Visible = false

end)

this is the TowerShop Module Script’s Content:

local TowerShop = {
	["Rocker"] = {
		["Name"] = "Rocker",
		["ImageAsset"] = "rbxassetid://7471197733",
		["Description"] = "He can play his way in.",
		["Price"] = 150,
	},
	["Magician"] = {
		["Name"] = "Magician",
		["ImageAsset"] = "rbxassetid://7471197733",
		["Description"] = "This magic geezer can help defend your base",
		["Price"] = 100,
	},
	["Soldier"] = {
		["Name"] = "Soldier",
		["ImageAsset"] = "rbxassetid://7471197733",
		["Description"] = "Recruit from R6S",
		["Price"] = 50,
	},
	["Birdy"] = {
		["Name"] = "Birdy",
		["ImageAsset"] = "rbxassetid://7471197733",
		["Description"] = "Constantly summons battle birds that swarm groups of enemies for a while then flies off.",
		["Price"] = 3500,
	},
	["Chemical Tyrant"] = {
		["Name"] = "Chemical Tyrant",
		["ImageAsset"] = "rbxassetid://7471197733",
		["Description"] = "This mad scientist can switch between a variety of chemical attacks to adjust to whatever enemies are present in the moment.",
		["Price"] = 4000,
	},
	["Agent 69"] = {
		["Name"] = "Agent 69",
		["ImageAsset"] = "rbxassetid://7471197733",
		["Description"] = "An elite from [REDACTED] has arrived to help by providing bounty funds aswell.",
		["Price"] = 2500,
	},
	["Crossbower"] = {
		["Name"] = "Crossbower",
		["ImageAsset"] = "rbxassetid://7471197733",
		["Description"] = "What happens when medieval France meets modern tech? Well her I guess, the sheer damage she outputs makes the geneva convention look like a suggestion",
		["Price"] = 20000,
	},
}

return TowerShop

I tried going into the Table’s documents but I couldn’t find anything that’s related. If there was then I’m either blind or I did not read it or skipped it. I tried searching for problems like mine online and I couldn’t find any, then again, I either didn’t see it or something.

Make the buttons name the same as the string in the table.

Here is something i scripted that prints out data after finding a string in a table

local String1 = 'TestString1'
local String2 = 'TestString2'

local ItemData = {
	["TestString1"] = {
		["Property"] = 'Print Here : TS1'
	}
}

local ItemData2 = {
	["TestString2"] = {
		["Property"] = 'Print Here : TS2'
	}
}

if ItemData[String1] then
	print('Da1'..ItemData[String1].Property)
end
if ItemData[String2] then
	print('Da1'..ItemData[String2].Property)
end

if ItemData2[String1] then
	print('Da2'..ItemData2[String1].Property)
end
if ItemData2[String2] then
	print('Da2'..ItemData2[String2].Property)
end

Running that code should make your output look like this:

  16:20:16.773  Da1Print Here : TS1  -  Client - LocalScript:21
  16:20:16.773  Da2Print Here : TS2  -  Client - LocalScript:31

You can modify this into your script by changing the printing to setting a string on a textlabel, and by making it activate on a button click.

Button code is here:

-- I wait for the player and humanoid to load to avoid any potential errors
local p = game.Players.LocalPlayer
local c = p.Character or p.CharacterAdded:Wait()
local h = c:WaitForChild('Humanoid')

-- Button names and data is stored here
local ButtonData = {
	["Tank Guy"] = {
		["String"] = 'Tank Guy is a Tank'
	};
	["Short Guy"] = {
		["String"] = 'Short Guy is Short'
	};
}

-- The list of all your buttons
local Buttons = {
	script.Parent:WaitForChild('Tank Guy');
	script.Parent:WaitForChild('Short Guy')
}

-- A text label that gets updated
local TextLabel = script.Parent:WaitForChild('TextLabel')

-- The function to update the text label
function UpdateTextLabel(Button)
	if ButtonData[Button.Name] then
		TextLabel.Text = ButtonData[Button.Name].String
	end
end

-- In a few lines, this calls the update function whenever one of your buttons is clicked.
for i, v in pairs(Buttons) do
	v.MouseButton1Click:Connect(function()
		UpdateTextLabel(v)
	end)
end