I want this for loop to change the properties of multiple parts at the same time. In this case I'm changing the parts' transparencies and with this for loop it changes one part's transparency and then it changes the other after. I want to make it change both at the same time. Here is my script, please see if you can help me.
Local Script
local button = workspace.BUTTON.Activator
local seconds = 30
local bar = script.Parent.Frame.Bar
local text = bar.Parent.TextBox
local db = false
button.Touched:Connect(function(hit)
if db == false then
db = true
print("Button was hit")
if hit.Parent:FindFirstChild("Humanoid") then
for i,v in pairs(workspace:GetChildren())do
if v.Name == "button activated brick" then
for i = 0, 1, 0.01 do
v.Transparency = i
if i == 1 then
db = false
v.CanCollide = false
end
wait(seconds/100)
end
end
end
end
elseif db == true then
return
end
end)
local timedb = false
button.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if timedb == false then
timedb = true
for i = 30,0,-1 do
Text.Text = i.." seconds"
local percentage = i/30
bar:TweenSize(UDim2.new(percentage,0,1,0),Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5)
if i == 0 then
timedb = false
end
wait(1)
end
end
end
end)
Thanks for your time in reading this. I appreciate all effort going into answering this question.

6 comments
You could run the same code in another thread? though I don't think it'd be efficient performance wise
I tried that but it broke. I'm not quite sure why though.
So are you basically saying that there was a time delay between making the first part transparent and the second part?
Yes
Well, not really actually
What it did was first make one part transparent then after 30 seconds, once that was fully transparent it started making the other part transparent. I want them both to happen at the same time.