I have a dependency system with my buttons so that if I buy a button another appears.
The only problem is, that if I buy a button the other one doesn’t appear.
It does become disabled, though.
I searched everything and I’m trying to fix this since 2 days and I just can’t seem to do it.
Here’s my code:
-- buy functions --
coroutine.wrap(function()
for _, currentButton in ipairs(Buttons:GetChildren()) do
local bought = currentButton.Bought.Value
for _, currentDependency in currentButton.DependOn:GetChildren() do
if currentDependency.Value.Bought.Value == true then
currentDependency:Destroy()
end
if #currentButton.DependOn:GetChildren() > 0 then
currentButton.Button.Transparency = 1
currentButton.Button.CanCollide = false
currentButton.Button.ppr.Enabled = false
elseif #currentButton.DependOn:GetChildren() == 0 and not bought then
currentButton.Button.Transparency = 0
currentButton.Button.CanCollide = true
currentButton.Button.ppr.Enabled = true
else
warn("not a number (maybe checking wrong thing?)")
end
end
end
end)()
Thanks for helping!