How can I animate the textures of all parts in a folder simultaneously?

Yo.

I have a folder that includes all parts that have a water texture and I want to animate all of these parts’ textures by changing their OffsetStuds property infinitely.

Problem is that I have no idea how to do this. I tried a for loop with ipairs but it kinda just does it one by one after each part, which is not what I want. I want all of these parts’ textures to be animated simultaneously with no end. This is the code that I tried:

local WaterFolder = game.Workspace["Level 1"]:WaitForChild("WaterFolder")

local info = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, -1)

while true do
	for i, v in ipairs(WaterFolder:GetDescendants()) do
		task.wait()
		if v:IsA("Texture") then
			v.OffsetStudsV = v.OffsetStudsV - 0.1
			task.wait(0.01)
		end
	end
end

Any help is greatly appreciated.

1 Like
while true do
	for i, v in ipairs(WaterFolder:GetDescendants()) do
		if v:IsA("Texture") then
			task.spawn(function()
				v.OffsetStudsV -= 0.1
			end)
		end
	end
end
1 Like