The part that fires it is at the bottom. No errors. The print("test") part doesnt fire when the amount is changed.
local al = script.Parent.AMOUNTLEFT
function changed()
print("test")
local nl = script.Parent.AMOUNTLEFT.Value
for i,v in pairs(script.Parent:GetChildren())do
if v.Name == "Bamboo 1" then
for i,vv in pairs(v:WaitForChild("Bamboo 1")["Parts to (Collect)"]:GetChildren())do
if nl == 5 then
if vv.Name == "B1" then
vv.Transparency = 0
end
if vv.Name == "B2" then
vv.Transparency = 0
end
if vv.Name == "B3" then
vv.Transparency = 0
end
if vv.Name == "B4" then
vv.Transparency = 0
end
if vv.Name == "B5" then
vv.Transparency = 0
end
end
if nl == 4 then
if vv.Name == "B1" then
vv.Transparency = 1
end
if vv.Name == "B2" then
vv.Transparency = 0
end
if vv.Name == "B3" then
vv.Transparency = 0
end
if vv.Name == "B4" then
vv.Transparency = 0
end
if vv.Name == "B5" then
vv.Transparency = 0
end
end
if nl == 3 then
if vv.Name == "B1" then
vv.Transparency = 1
end
if vv.Name == "B2" then
vv.Transparency = 1
end
if vv.Name == "B3" then
vv.Transparency = 0
end
if vv.Name == "B4" then
vv.Transparency = 0
end
if vv.Name == "B5" then
vv.Transparency = 0
end
end
if nl == 2 then
if vv.Name == "B1" then
vv.Transparency = 1
end
if vv.Name == "B2" then
vv.Transparency = 1
end
if vv.Name == "B3" then
vv.Transparency = 1
end
if vv.Name == "B4" then
vv.Transparency = 0
end
if vv.Name == "B5" then
vv.Transparency = 0
end
end
if nl == 1 then
if vv.Name == "B1" then
vv.Transparency = 1
end
if vv.Name == "B2" then
vv.Transparency = 1
end
if vv.Name == "B3" then
vv.Transparency = 1
end
if vv.Name == "B4" then
vv.Transparency = 1
end
if vv.Name == "B5" then
vv.Transparency = 0
end
end
if nl == 0 then
if vv.Name == "B1" then
vv.Transparency = 1
end
if vv.Name == "B2" then
vv.Transparency = 1
end
if vv.Name == "B3" then
vv.Transparency = 1
end
if vv.Name == "B4" then
vv.Transparency = 1
end
if vv.Name == "B5" then
vv.Transparency = 1
end
end
end
end
end
end
script.Parent.AMOUNTLEFT.Changed:Connect(changed)

1 comment
do not use .Value in variables. and change the value with server.