Hello! I'm making a script where when I click on a button, the property of multiple parts with the same name gets changed, but I can't make it work. What have I done wrong?
local ClickDetector = script.Parent.ClickDetector
ClickDetector.MouseClick:Connect(function(clicked)
for i,v in pairs(workspace:GetChildren()) do
if v:IsA("Part") then
if v.Name == "Name" then
if v.Transparency == 0.8 then
v.Transparency = 1
elseif v.Transparency == 1 then
v.Transparency = 0.8
end
end
end
end
end)
