Help with for loop

I am attempting to save some data with a timed loop. For some reason the loop is not waiting the three seconds and I can’t figure out why. I have tried everything I have thought of but nothing seems to work.
Thanks for the help, here is the code:

local slot = script.Parent.Parent
local foldernum = workspace.Slot.Folders.Value
game.ReplicatedStorage.Save.Save.OnServerEvent:Connect(function(plr)
	for i = 1,foldernum,1 do
		
		local v = workspace.Slot:FindFirstChild("Folder"..i)
			local foldername = v.Name
			print("Saved "..foldername)
			local DS = game:GetService("DataStoreService"):GetDataStore(foldername)
			local Save = require(game.ServerScriptService.Serializer)

			if plr.Name == workspace.Owner.Value then
			local result, problem = pcall(function()
			DS:SetAsync(tostring(game.Players:FindFirstChildOfClass("Player").UserId), Save.Encrypt(v:GetChildren()))
					
			end)

			if not(result) then 
			error(problem)
			end
		end
	wait(3)	
	end
end)