when clicking a button in my inventory i have a string attached to it that changes. When i click said button it gives it the string and when i click another button it gives it the string too but the first button i clicked also has this string still. how would i set the first buttons string to nil when i click another button?
for i, tower in pairs(towerShop) do
local oldButton = container:FindFirstChild(tower.Name)
if oldButton then
oldButton:Destroy()
end
local newButton = container.Template:Clone()
local status = getTowerStatus(tower.Name)
if status == "Equipped" then
newButton.Status.Text = "Equipped"
else
newButton.Status.Text = ""
end
if status == "Owned" or status == "Equipped" then
newButton.Name = tower.Name
newButton.TowerName.Text = tower.Name
newButton.Visible = true
newButton.Parent = container
newButton.Activated:Connect(function()
status = "Selected"
--HERE I SET THE STRING TO SELECTED--
for i, v in pairs(info.Display:GetChildren()) do
if v:IsA("ViewportFrame") then
v:Destroy()
end
end