Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a for i statement for mulitple parts go at once? [SOLVED BY ME]

I wrote this script with weather, the clouds aren't going All at once. Any help? Ignore the Movement and stuff

SCRIPT:

for i,v in pairs(workspace.Clouds:GetChildren()) do
	v.Movement.Disabled = false
	for i = 1,0.5,-0.01 do
		v.Decal.Transparency = i
		v.Decal0.Transparency = i
		wait(0.2)
	end
end

2 answers

✓ Accepted answer

two ways in this case, using coroutines/spawn or using tweens (replaces the nested loop and since tweens dont yield the basically all play at the same time)

coroutines example

for i,v in pairs(workspace.Clouds:GetChildren()) do
    	v.Movement.Disabled = false
    	coroutine.wrap(function() 
			for i = 1,0.5,-0.01 do
        			v.Decal.Transparency = i
        			v.Decal0.Transparency = i
       				 wait(0.2)
   			 end
	end)()
end

SOLVED BY ME All I had to do is move the wait to the 1st for i instead of the 2nd

This discussion is preserved as it was. New answers, comments, and votes are closed.