Hello devs!
I have problem with making transparency few parts at the same time.
Here is example what I mean:
When someone makes doors which are getting transparency when someone clicks on these door he uses code like this:
script.Parent.ClickDetector.MouseClick:Connect(function()
script.Parent.Part.Transparency = 0.5
script.Parent.Part2.Transparency = 0.5
script.Parent.Part.CanCollide = false
script.Parent.Part2.CanCollide = false
wait(5)
script.Parent.Part.Transparency = 0
script.Parent.Part2.Transparency = 0
script.Parent.Part.CanCollide = true
script.Parent.Part2.CanCollide = true
end)
But I want to make code like this:
script.Parent.ClickDetector.MouseClick:Connect(function()
allParts.Transparency = 0.5
allPartsCanCollide = false
wait(5)
allParts.Transparency = 0
allParts.CanCollide = true
end)
I know I can union them but I’m using SurfaceGui on these doors.
Here is my code:
for i, Level in pairs(Map:GetChildren()) do
Level.lever.ClickDetector.MouseClick:Connect(function(plr)
if Level.lever.Type.Value == "Door" then
local doorassets = Level.door:GetChildren()
for i = 1, #doorassets do
if not doorassets[i]:IsA("Model") then
doorassets[i].Transparency = 0.5
wait(7)
doorassets[i].Transparency = 0
end
end
end
print(plr,"Completed",Level.Name,"at",Map.Name)
end)
end
in pairs loop won’t work bc It makes 1 part transparency = 0.5 and after 7 seconds it will make it transparency = 0 and then next part will be transparency = 0.5