Status System (Proper? Nesting functions with loops)

Is this an efficient way to code status inflictions? Also do you think its worrisome to have nesting functions with loops?

local StatusFolder = script.Parent
local Character = StatusFolder.Parent

local StatusInflictions = {
	["Stun"] = {
		Inflict = function(status)
			while status:GetAttribute("Counting") == true do
				Character.Humanoid.WalkSpeed = 1
				task.wait()
			end
		end,
		Uninflict = function(status)
			Character.Humanoid.WalkSpeed = 16
		end
		},
	["CombatTag"] = {
		Inflict = function(status)
			-- CombatTag gui appears
		end,
		Uninflict = function(status)
			-- CombatTag gui disappears
		end
	},
}

local function InflicStatus(status)
	spawn(function()
		StatusInflictions[status.Name].Inflict(status)
		while status:GetAttribute("Counting") == true do
			task.wait()
		end
		StatusInflictions[status.Name].Uninflict(status)
	end)
end
for _,status in (StatusFolder:GetChildren()) do
	if status:IsA("NumberValue") then
		status:GetPropertyChangedSignal("Value"):Connect(function()
			if status:GetAttribute("Counting") == true then return end
			status:SetAttribute("Counting", true)
			InflicStatus(status)
			while status.Value > 0 do
				status.Value = math.clamp(status.Value - 0.01,0,math.huge)
				task.wait(0.01)
			end
			status.Value = 0
			status:SetAttribute("Counting", false)
		end)
	end
end