I am trying to make a current level system for upgrades in my shop. All of this should work but the text doesn’t change. How do I fix this?
Script:
local upgradesFolder = player:WaitForChild("Upgrades")
local upgrades = {
multiplier = upgradesFolder:WaitForChild("Multiplier"),
backpack = upgradesFolder:WaitForChild("Backpack"),
cashPerSell = upgradesFolder:WaitForChild("CashGiver"),
rankName = upgradesFolder:WaitForChild("name"),
}
function FindLevel()
for i, d in pairs(script.Parent:GetDescendants("CurrentLevel")) do
if d.Name == "CurrentLevel" then
for i, upg in pairs(upgrades) do
if d.Parent.Name == upg.Name then
local label = d
label.Text = string.gsub(label.Text, "_", upg.Value)--This text doesn't change for some reason whenever the value changes
end
end
end
end
end
FindLevel()
for i, upg in pairs(upgrades) do
upg:GetPropertyChangedSignal("Value"):Connect(FindLevel)
end