How would I make all the parts in this sliding-door-script move simultaneously?
Right now, it moves the parts one-by-one, which is not what I want it to do...
I want the parts to move simultaneously so that it looks like a real-life sliding door.
My current coding is as follows:
local Sensor = script.Parent.Sensor.Part
local Door1 = script.Parent.Door1
doorClosed = true
Sensor.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
if doorClosed then
doorClosed = false
for i,v in ipairs(Door1:GetChildren()) do
for i = 1,30,1 do
v.CFrame = CFrame.new(v.Position + Vector3.new(-0.2,0,0))
wait()
end
end
end
end
end)
Any help is greatly appreciated!

1 comment
Remove the wait. If you want the door to be animated, I think you have to move the for loop outside the pairs loop and move the wait outside the pairs loop as well.